PHP Classes

Abbey's Autoloader: Load classes automatically from directories

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 30%Total: 1,156 All time: 3,275 This week: 455Up
Version License PHP version Categories
abtoloader 1.0BSD License5.0PHP 5, Language
Description 

Author

The key part of this class is that it *autoloads based on scope* (EDITORS: Please do not delete this).

What this means is that when an autoload happens, the loader will prefer the declarations that occurred in the file the autoload event happened in, and only afterwards default to the global scope. In the event a class definition cannot be loaded a dummy class is passed back into the execution context which throws an error during construction. This allows class definition errors to be caught as well as delivering their stacktrace.

Because this scope allows the use of packages and namespaces (to a very limited extent), I have included an _import() function which uses a Java-like syntax, for those of us who prefer that. It currently enforces a '<name>.class.php' naming convention for autoloaded classes.

Picture of Abbey Sparrow
Name: Abbey Sparrow <contact>
Classes: 4 packages by
Country: United States United States
Age: 47
All time rank: 72895 in United States United States
Week rank: 192 Up22 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files (1)  
File Role Description
Plain text file Autoloader.class.php Class The main class

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  
 0%
Total:1,156
This week:0
All time:3,275
This week:455Up
 User Ratings  
 
 All time
Utility:50%StarStarStar
Consistency:50%StarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:30%StarStar
Rank:4332