The uopz extension is focused on providing utilities to aid with unit testing PHP code.
It supports the following activities:
- Intercepting function execution
- Intercepting object creation
- Hooking into function execution
- Manipulation of function statics
- Manipulation of function flags
- Redefinition of constants
- Deletion of constants
- Runtime creation of functions and methods
Note: All of the above activities are compatible with opcache
Documentation: http://php.net/uopz