PHP Classes

frdl Autoloader: Autoload classes with PSR-0, PSR-4, mapping, etc.

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 68%Total: 216 This week: 1All time: 8,306 This week: 38Up
Version License PHP version Categories
source-loader 0.9.21BSD License5.3PHP 5, Language, Stream wrappers
Description 

Author

This class can autoload classes with PSR-0, PSR-4, mapping, etc.

It implements several types of autoload strategies that can be configured dynamically.

Currently it can autoload classes from given directories follow PSR-0 or PSR-4 specifications, or map specific classes to given files, call existing __autoload function, or load a class from remote server.

Innovation Award
PHP Programming Innovation award nominee
April 2015
Number 13
Autoloading is a PHP feature that allows to automatically load classes according to rules defined by autoloader code.

This package implements multiple common autoloading strategies like PSR-0, PSR-4, class mapping, etc..

Manuel Lemos
Picture of Till Wehowski
  Performance   Level  
Name: Till Wehowski <contact>
Classes: 30 packages by
Country: Germany Germany
Age: 45
All time rank: 107269 in Germany Germany
Week rank: 49 Up3 in Germany Germany Up
Innovation award
Innovation award
Nominee: 12x

Example

<?php
/**
 * SourceLoader example usage
 */

require 'SourceLoader.php';

frdl\webfan\Autoloading\SourceLoader::top()
   ->
addPsr4('frdl\\', DIRECTORY_SEPARATOR . 'pathToDir' . DIRECTORY_SEPARATOR, true)
   ->
addPsr0('aNamespace\\', DIRECTORY_SEPARATOR . 'pathToDir-Old' . DIRECTORY_SEPARATOR, false)
   ->
class_mapping_add('MyClass', DIRECTORY_SEPARATOR . 'pathToDir' . DIRECTORY_SEPARATOR .'cl.MyClass.php', $success)
   ->
autoload_register()
   ->
unregister(array(frdl\webfan\Autoloading\SourceLoader::top(),'autoloadClassFromServer'))
;


  Files folder image Files (5)  
File Role Description
Accessible without login Plain text file Autoloader.php Example Example script
Accessible without login Plain text file example.php Example Example
Accessible without login Plain text file Loader.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file SourceLoader.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 80%
Total:216
This week:1
All time:8,306
This week:38Up
 User Ratings  
 
 All time
Utility:93%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:62%StarStarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:68%StarStarStarStar
Rank:374