Closed compworkmail closed 8 years ago
You're aware Composer does this job for you? After installing the package with composer you only have to include the autoload.php
file and all classes will be available.
Oh, thanks, I didn't know about Composer's feature
Hello. I want to advice you to add to the examples, for example to index.php file which is in the root of the site next code to autoload all the classes:
<?php
use DirkGroenen\Pinterest\Pinterest;
require_once(DIR . '/src/Pinterest/Pinterest.php');
function autoload($class_name) { $class_name = str_replace('\', '/', $class_name); $class_name = str_replace('DirkGroenen/', '', $class_name); require_once(__DIR . "/src/$class_name.php"); }
$pinterest = new Pinterest('your_id', 'your_secret');
This code is ready to work and developers don't need to add each file like: require_once('curl'); require_once('auth'); ... etc.