PHP code example of phine / psr4

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

    

phine / psr4 example snippets


use Phine\PSR4\Loader();

$loader = new Loader();

$loader->map('Namespace\\Prefix', '/base/directory/path');

$loader
    ->map('One\\Prefix', '/one/path')
    ->map('Two\\Prefix', '/two/path')
    ->map('Three\\Prefix', '/three/path');

$loader->register();

$myInstance = new One\Prefix\MyClass();

use Phine\PSR4\DebugLoader;

$loader = new DebugLoader();

use Phine\PSR4\APCLoader;

$loader = new APCLoader($cacheKeyPrefix);