Login   Register  
PHP Classes

phpPlugin: Dynamically extend a PHP class using plug-ins

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author Author  
Picture of David Bittencourt
Name: David Bittencourt <e-mail contact>
Packages: 1 Browse all classes by David Bittencourt Browse all classes by
Country: Brazil Brazil - PHP jobs in Brazil
Age: 32
All time rank: 96068 in Brazil Brazil
Week rank: 1991 Down155 in Brazil Brazil Down
Innovation award
Innovation award
Nominee: 1x

  Detailed description   Download Download .zip .tar.gz  
This class is meant to dynamically extend any object of a class with new plug-in functions or collections of functions that are defined in separate files or from variables.

It works by dynamically creating a new sub-class of the class of given object adding the plug-in functions that are specified at runtime.

The name of the loaded plugin functions are stored in the object to prevent loading the same plugin more than once, but you still can force a reload so a new plugin can replace an old one.

  Classes of David Bittencourt  >  phpPlugin  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: phpPlugin
Base name: phpplugin
Description: Dynamically extend a PHP class using plug-ins
Version: -
PHP version: -
License: Freely Distributable
All time users: 2956 users
All time rank: 1135
Week users: 0 users
Week rank: 1804 Equal
  Groups   Rate classes User ratings   Applications   Files Files  

Group folder image Language Constructs to assist in the language control View top rated classes
Group folder image Code Generation Compilers and tools that generate code automatically View top rated classes

  Innovation Award  
PHP Programming Innovation award nominee
June 2004
Number 2

Prize: One copy of the Zend Studio
The usual method for extending a class to add new functionality without having to change the class code is to create a subclass with new functions and variables that implement the new functionality.

However, if several people extend the same class with their own subclasses, it is difficult benefit from extensions developed by different people because their subclasses are separated.

This class implements a very innovative solution for extending a class using independent plug-in functions. It works by generating a new subclass that combines multiple functions that are defined in separate script files.

This way any developer may create a new class extension combining the functions defined by the plug-ins that they are interested, providing a more flexible and thus more powerful means of code reuse.

Manuel Lemos

  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Sufficient (73.2%) Sufficient (75.0%) - Good (80.4%) - - Not sure (52.1%) 1446
Month: Not yet rated by the users

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Files folder imageplugins (2 files)
Accessible without login Plain text file example.php Example Example script
Plain text file plugin.class.php Class Main class
Accessible without login Plain text file test.php Example test.php

  Files  /  Files folder image plugins  
File Role Description
  Accessible without login Plain text file bar.func.php Aux. Plugin bar() for test.php and example.php
  Accessible without login Plain text file bar.php Aux. Different bar() plugin for test.php and example.php

Download Download all files: phpplugin.tar.gz phpplugin.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.