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
- Can create callbacks directly (through CCallback and derived
- Can create method callbacks by calling _callback() method on
- 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.