Login   Register  
PHP Classes
elePHPant
Icontem

Manager Class: Load classes when a function is called

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2011-10-10 (3 years ago) RSS 2.0 feedNot enough user ratingsTotal: 458 All time: 5,557 This week: 1,379Up
Version License PHP version Categories  
manager_class 1.0BSD License5.0PHP 5, Language
Description Author  

This class can load classes when a function is called.

It handles calls to non-existent functions by checking the name of the called function and loading a class with the same name including a script with derived name.

The name of the directory from where the class files are included is configurable.

If the called function includes an underscore character, the class also calls the class function with the name that follows the underscore character. Otherwise, the class calls the constructor function with the same name of the class.

Innovation Award  
PHP Programming Innovation award nominee
October 2011
Number 9
Loading and initializing classes is often a tedious process that developers need to implement in their PHP scripts.

This manager class provides an alternative method that simplifies the process by loading a class automatically when a virtual function with the same name of the class to be loaded is called on the manager class.

The manager class takes care of both loading the classes and calling their initialization functions.

Manuel Lemos
Picture of TB
Name: TB <contact>
Classes: 1 package by
Country: Romania Romania
Age: ???
All time rank: 303867 in Romania Romania
Week rank: 1580 Up35 in Romania Romania Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Files folder imageclasses (2 files)
Plain text file Manager.class.php Class Manager Class File
Plain text file readme.txt Doc. Important readme file
Plain text file index.php Example Example file

  Files folder image Files  /  classes  
File Role Description
  Plain text file test.class.php Aux. An example class
  Plain text file test2.class.php Aux. A second example class

 Version Control Unique User Downloads Download Rankings  
 0%Total:458All time:5,557
 This week:0This week:1,379Up