Skip to content

pprkut/autoload-psr

Repository files navigation

Autoload PSR

PHP PSR-0/PSR-4 Autoloader

Tests

The autoload_psr extension provides an integrated autoloader for PHP to load classes according to PSR-0 and/or PSR-4.

The autoloader registers itself with SPL, so you no longer need to care about specifically setting up an autoloader for your project. PSR-0 works out of the box, no further setup needed. To use PSR-4 you need to register the respective namespace prefixes that you would like to use in your project.

API

The PHP API for autoload_psr

/**
* Register a namespace prefix for PSR-4.
* @param string prefix
* @param string path
**/
function autoload_register_psr4_prefix(string prefix, string path) : void;

Installation

$> phpize
$> ./configure
$> make
$> make install

Once installed you need to add

extension=autoload_psr.so

to your php.ini file.