Login   Register  
PHP Classes
elePHPant
Icontem

Magic PHP Auto-Instantiator: Include and create objects with a single command

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-06-05 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 319 This week: 6All time: 6,420 This week: 267Up
Version License PHP version Categories  
autoinstantiator 1The PHP License3.0PHP 5, Language
Description Author  

This class can include classes and create objects with a single command.

It registers an error handler so when the PHP engine finds a line in PHP code in the form of directory.subdirectory.class; it triggers an error notice that calls the registered error handler.

The error handler loads the PHP script that triggered the error and parses the code to determine the directory path of the class file to be included.

Then the class creates an object stored in global variable of the specified class name.

Innovation Award  
PHP Programming Innovation award nominee
June 2014
Number 6
Creating a new object usually requires to load the class file explicitly or using an auto-loader before creating an object of the loaded class.

This class provides a simpler solution that just requires a single line of code to automatically load the class and create an object of that class.

Manuel Lemos
Picture of Andoitz Jordan Marmolejo
Name: Andoitz Jordan Marmolejo is available for providing paid consulting. Contact Andoitz Jordan Marmolejo .
Classes: 7 packages by
Country: Spain Spain
Age: 24
All time rank: 143328 in Spain Spain
Week rank: 79 Up5 in Spain Spain Up
Innovation award
Innovation award
Nominee: 3x

Winner: 2x

  Files folder image Files  
File Role Description
Files folder imagecom (1 directory)
Accessible without login Plain text file index.php Example Main Script
Accessible without login Plain text file Readme.txt Doc. Readme document
Accessible without login Plain text file Readme.md Doc. Documentation

  Files folder image Files  /  com  
File Role Description
Files folder imagephpclasses (2 files)

  Files folder image Files  /  com  /  phpclasses  
File Role Description
  Plain text file import.php Class Main mphpai class
  Plain text file myClass.php Class Simple Example Class

 Version Control Unique User Downloads Download Rankings  
 80%Total:319All time:6,420
 This week:6This week:267Up