PHP Classes

Dynamic Methods: Add class functions dynamically from script files

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 54%Total: 527 This week: 1All time: 5,669 This week: 560Up
Version License PHP version Categories
dynamic-methods 1.0The PHP License5.3PHP 5, Language
Description 

Author

This class can be used to add class functions dynamically from script files.

It traps calls to inexistent class functions. The class loads script files with the same name as the called function and uses the loaded code to implement the missing functions.

Innovation Award
PHP Programming Innovation award nominee
January 2011
Number 5


Prize: One subscription to the PDF edition of the PHP Architect magazine
One way to extend the functionality of a class is to load external plug-in scripts when certain functions are called.

The inconvenience of this approach is that usually needs to register somehow the functions that are implemented by plug-ins before calling them.

This class implements a more automatic approach that does not require prior plug-in registration.

It implements a default class call function which intercepts calls to missing functions and automatically loads on demand external plug-in scripts with names based on the called function.

Manuel Lemos
Picture of Pashkov Denis Igorevich
  Performance   Level  
Name: Pashkov Denis Igorevich <contact>
Classes: 21 packages by
Country: Ukraine Ukraine
Age: 33
All time rank: 3068 in Ukraine Ukraine
Week rank: 411 Down8 in Ukraine Ukraine Equal
Innovation award
Innovation award
Nominee: 10x

Winner: 1x

Details

Please Create folder parts and put file hello_world into it.

  Files folder image Files  
File Role Description
Plain text file foo Aux. foo
Plain text file hello_world Aux. part hello world
Plain text file main_class.php Class main class
Plain text file readme.txt Doc. readme
Plain text file samples.php Example example

 Version Control Unique User Downloads Download Rankings  
 0%
Total:527
This week:1
All time:5,669
This week:560Up
User Ratings User Comments (3)
 All time
Utility:67%StarStarStarStar
Consistency:85%StarStarStarStarStar
Documentation:60%StarStarStarStar
Examples:64%StarStarStarStar
Tests:-
Videos:-
Overall:54%StarStarStar
Rank:1987