apix-package autoloader
Light PSR-0 compliant autoloader for PHP5.3+ namespaces and older PEAR-style classes.
apix/autoloader
Light PSR-0 compliant autoloader for PHP5.3+ namespaces and older PEAR-style classes.
- Friday, March 22, 2013
- by frqnck
- Repository
- 1 Watchers
- 5 Stars
- 3,656 Installations
- PHP
- 2 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
APIx Autoloader, PSR-0 for PHP5.3+
Apix Autoloader is a light PSR-0 compliant autoloader which can autoload both PHP5.3 namespaces and older PEAR-style classes., (*1)
Basic usage
-
At its most basic, it will autoload PSR-0 complient class names in the current include-path:, (*2)
<?php
require '/path_to/Apix/Autoloader.php';
Apix\Autoloader::init();
-
If you want to add some paths to the include-path:, (*3)
<?php
require '/path_to/Apix/Autoloader.php';
$prepend = array('path/to/libs', 'path/to/vendor'); // paths to prepend
$append = array('path/to/last/dir'); // paths to append
Apix\Autoloader::init($prepend, $append);
Advanced usage
<?php
require '/path_to/Apix/Autoloader.php';
$loader = new Apix\Autoloader;
$loader->prepend('path/my/libs')
->prepend('path/vendors')
->append('some/other/path');
$loader->register(true); // True to take precedence on registered autoloaders.
// False (the default) to follow the stack order.
Installation
-
If you are creating a component that relies on Apix Autoloader locally:, (*4)
- either update your
composer.json
file:
{
"require": {
"apix/autoloader": "1.0.*"
}
}
- or update your
package.xml
file as follow:
<dependencies>
<required>
<package>
<name>apix_autoloader</name>
<channel>pear.ouarz.net</channel>
<min>1.0.0</min>
<max>1.999.999</max>
</package>
</required>
</dependencies>
-
For a system-wide installation, use PEAR as follow:, (*5)
sudo pear channel-discover pear.ouarz.net
sudo pear install --alldeps ouarz/apix_autoloader
Checkout pear.ouarz.net for more details., (*6)
License
Apix Autoloader is licensed under the New BSD license -- see the LICENSE.txt
for the full license details., (*7)