PHP Classes

Object Extensions for PHP: Extend objects with more functions and variables

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 584 All time: 5,262 This week: 237Up
Version License Categories
object-ext 1.0MIT/X Consortium ...PHP 5, Language
Description Author

This class can be used to extend already instantiated objects with new functions and variables.

It can also be used to define and call callback functions at run-time.

Picture of Andrew Hanna
Name: Andrew Hanna <contact>
Classes: 1 package by
Country: Canada Canada
Age: ???
All time rank: 306065 in Canada Canada
Week rank: 544 Up12 in Canada Canada Up

Object Extensions for PHP
A runtime object extension and callback library for PHP

The Object Extensions library for PHP adds the following functionality
to objects that extend the base class:

 - Runtime object extension to "extend" an object by another class at
   runtime (to virtually inherit all public properties and methods).
 - Runtime callback definitions to be able to pass function/method
   callbacks as variables, and subsequently execute them from other
 - Dynamic object properties class to handle runtime setting/getting
   of object properties, as well as ability to pass function arguments
   as object-based parameters rather than long list of options.


 - Base class (CExtendable) implements a _extend() function by which
   you may vritually extend an object by an instance of another object.
 - Extended object (object passed to _extend) can reference parent
   object if supported by extended class.
 - __get, __set and __call are all overriden to handle overriding
   undefined properties and methods
 - Ability to reference a callback in a straightforward manner
   ($object->_callback()->method(args, [...]))


 - Can create callbacks directly (through CCallback and derived
 - Can create method callbacks by calling _callback() method on
   CExtendable objects
 - When combined with object extension and object properties, can
   provide a really easy way to execute callbacks.


 - Base class extends ArrayIterator, all properties saved in an array
 - Basic functionality to check values provided and/or set default
 - Overrides __get, __set to get/set object properties.
 - Can limit property set-tability to existing properties only, or to
   provided array of properties.
 - Can enable read-only mode.
 - Overrides __call, and in the case that the a property value with
   the same name as the method name exists, and is an instance of the
   ICallback interface, this callback is executed.


Object Extensions for PHP uses PHP5 functionality.  It would be
theoretically possible to implement similar functionality into PHP4,
however, since I no longer develop in PHP4, I cannot properly test it.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file index.php Example Sample Usage
Accessible without login Plain text file LICENSE Lic. License
Accessible without login Plain text file README Doc. Read Me

  Files folder image Files  /  src  
File Role Description
  Plain text file object-ext.php Class Object Extensions Source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,262
This week:237Up
 User Ratings  
 All time
For more information send a message to info at phpclasses dot org.