PHP code example of djiele / autoloader

1. Go to this page and download the library: Download djiele/autoloader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

djiele / autoloader example snippets


// including the class file
e_once 'vendor/autoload.php'

use Djiele\PHP\Autoloader;

$autoloaderId = 'my-project-autoloader';
$useCache = true; // true to create/refresh and use generated cache file
$classLoader = new Autoloader($autoloaderId, $useCache); 
$classLoader
    ->setClassMapDir('cache/autoloader') // path to the cache file, created if not exists
    ->setFolders(['src', 'packages']) // array of directories to be analyzed
    ->register() // launch the analyze and register the class in autoload chain
;