PHP Classes

Dynamic Methods: Add class functions dynamically from script files

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
StarStarStar 54%Total: 527 All time: 5,670 This week: 455Up
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: 34
All time rank: 3068 in Ukraine Ukraine
Week rank: 170 Up3 in Ukraine Ukraine Up
Innovation award
Innovation award
Nominee: 10x

Winner: 1x

Details

Please Create folder parts and put file hello_world into it.

  Files folder image Files (5)  
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

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:527
This week:0
All time:5,670
This week:455Up
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:2010