obf / classloader
The Opsbears Framework Classloader Component
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 4 497
Dependents: 6
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
- ext-pcre: *
Requires (Dev)
- phpunit/phpunit: 4.*
README
This is the base component of the Opsbears Framework, which loads classes. It builds upon the SPL autoload facility and can be connected to the composer autoloader.
It has been built to facilitate better error messages in case of autoloading errors, as well as some additional
features, such as iClassLoadListener
, which is the OBF counterpart of Java static constructors.
Documentation
The API documentation is available at opsbears.github.io/obf-classloader.
Requirements
Since the OBF classloader uses namespaces, the minimum required PHP version is 5.3.0, but it contains support for traits as well. It also requires the PCRE extension to work. For other OBF components, however, 5.4.0 is the minimum required version because they actively use traits.
Usage
Composer
If you are using composer, you can pull in the classloader as a dependency doing this:
composer require obf/classloader
Manual loading
If you are using some other dependency manager, use the src
directory as a root for OBF\Classloader like this:
require_once('/path/to/obf/classloader/src/ClassLoader.php'); //Add own path ClassLoader::addClassPath('/path/to/obf/classloader/src', 'OBF\\ClassLoader'); //Register az SPL autoloader ClassLoader::register();
This will enable the classloader.