PHP code example of jesseschalken / autoload-generator

1. Go to this page and download the library: Download jesseschalken/autoload-generator 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/ */

    

jesseschalken / autoload-generator example snippets




spl_autoload_register(function ($class) {
  static $map = array (
  'Project\\Foo' => 'Foo.php',
  'Project\\Bar' => 'Bar.php',
  'Project\\Class1' => 'lots of classes.php',
  'Project\\Class2' => 'lots of classes.php',
  'Project\\Class3' => 'lots of classes.php',
);

  if (isset($map[$class])) {
    

    php composer.phar 

    ./vendor/bin/php-generate-autoload src/autoload.php
    

    "autoload": {
        "files": ["src/autoload.php"]
    }
    

./vendor/bin/php-generate-autoload src/autoload.php