PHP code example of webiny / class-loader

1. Go to this page and download the library: Download webiny/class-loader 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/ */

    

webiny / class-loader example snippets


      use Webiny\Component\ClassLoader;

    ClassLoader::getInstance();

    ClassLoader::getInstance()->registerMap([
    										// a namespace rule (PSR-4 - default)
    										'Webiny' => realpath(dirname(__FILE__)).'/library/Webiny',
    										// a namespace rule (PSR-0)
    										'Symfony' => [
    										    'Path' => '/var/vendors/Symfony',
    										    'Psr' => 0
    										],
    										// a PEAR rule
    										'Swift_' => realpath(dirname(__FILE__)).'/library/Swift',
    										]);

    ClassLoader::getLoader()->registerCacheDriver($instanceOfCacheInterface);

    ClassLoader::getInstance()->registerMap([
        'Smarty_' => [
                        'Path'      => '/var/www/Vendors/Smarty/libs/sysplugins',
                        'Normalize' => false,
                        'Case'      => lower
                     ]
    ]);