PHP ZEND autoloader code for Zend and Your classes

Simplest PHP ZEND autoloader code to autoload Zend classes and Your classes

<?php
require_once '/usr/lib/Zend/Loader/AutoloaderFactory.php';
require_once '/usr/lib/Zend/Loader/ClassMapAutoloader.php';

// ZEND CLASSES

$config = array(
    'Zend\Loader\StandardAutoloader' => array(
        'namespaces' => array(
            'Zend'      => '/usr/lib/Zend',
            'ZendXml'   => '/usr/lib/ZendXml',
        ),
    ),
);

Zend\Loader\AutoloaderFactory::factory($config);

// YOUR CLASSES

$loader = new Zend\Loader\ClassMapAutoloader();

// Register the class map:
$loader->registerAutoloadMap(__DIR__ . '/autoload_classmap.php');

// Register with spl_autoload:
$loader->register();
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s