PHPackages                             krakjoe/uopz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. krakjoe/uopz

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

krakjoe/uopz
============

User Operations for Zend

3731255[10 issues](https://github.com/krakjoe/uopz/issues)[1 PRs](https://github.com/krakjoe/uopz/pulls)CCI passing

Since Sep 15Pushed 7mo ago14 watchersCompare

[ Source](https://github.com/krakjoe/uopz)[ Packagist](https://packagist.org/packages/krakjoe/uopz)[ RSS](/packages/krakjoe-uopz/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (1)Used By (0)

UOPZ
====

[](#uopz)

*User Operations for Zend*

[![Build and Test](https://github.com/krakjoe/uopz/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/krakjoe/uopz/actions/workflows/ci.yml)[![Coverage Status](https://camo.githubusercontent.com/017bafc616ef273d9dda000f92b494c3e0110ec0a59a44d6674dc64f7f566fa5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b72616b6a6f652f756f707a2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/krakjoe/uopz?branch=master)

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*

Requirements and Installation
=============================

[](#requirements-and-installation)

If you use XDebug you need to use version 2.9.4 or higher.

See [INSTALL.md](INSTALL.md)

API
===

[](#api)

*The PHP API for `uopz`*

```
/**
* Provide a return value for an existing function
* @param string class
* @param string function
* @param mixed value
* @param bool execute
* If value is a Closure and execute flag is set, the Closure will
* be executed in place of the existing function
**/
function uopz_set_return(string class, string function, mixed value [, bool execute = 0]) : bool;

/**
* Provide a return value for an existing function
* @param string function
* @param mixed value
* @param bool execute
* If value is a Closure and execute flag is set, the Closure will
* be executed in place of the existing function
**/
function uopz_set_return(string function, mixed value [, bool execute = 0]) : bool;

/**
* Get a previously set return value
* @param string class
* @param string function
**/
function uopz_get_return(string class, string function) : mixed;

/**
* Get a previously set return value
* @param string function
**/
function uopz_get_return(string function) : mixed;

/**
* Unset a previously set return value
* @param string class
* @param string function
**/
function uopz_unset_return(string class, string function) : bool;

/**
* Unset a previously set return value
* @param string function
**/
function uopz_unset_return(string function) : bool;

/**
* Use mock in place of class
* @param string class
* @param mixed mock
* Mock can be an object, or the name of a class
**/
function uopz_set_mock(string class, mixed mock);

/**
* Get previously set mock for class
* @param string class
**/
function uopz_get_mock(string class);

/**
* Unset previously set mock
* @param string class
**/
function uopz_unset_mock(string class);

/**
* Get static variables from method scope
* @param string class
* @param string function
**/
function uopz_get_static(string class, string function) : array;

/**
* Get static variables from function scope
* @param string function
**/
function uopz_get_static(string function) : array;

/**
* Set static variables in method scope
* @param string class
* @param string function
* @param array static
**/
function uopz_set_static(string class, string function, array static);

/**
* Set static variables in function scope
* @param string function
* @param array static
**/
function uopz_set_static(string function, array static);

/**
* Execute hook when entering class::function
* @param string class
* @param string function
**/
function uopz_set_hook(string class, string function, Closure hook) : bool;

/**
* Execute hook when entering function
* @param string function
**/
function uopz_set_hook(string function, Closure hook) : bool;

/**
* Get previously set hook on class::function
* @param string class
* @param string function
**/
function uopz_get_hook(string class, string function) : Closure;

/**
* Get previously set hook on function
* @param string function
**/
function uopz_get_hook(string function) : Closure;

/**
* Remove previously set hook on class::function
* @param string class
* @param string function
**/
function uopz_unset_hook(string class, string function) : bool;

/**
* Remove previously set hook on function
* @param string function
**/
function uopz_unset_hook(string function) : bool;

/**
* Add a non-existent method
* @param string class
* @param string function
* @param Closure handler
* @param int flags
* @param bool all
* If all is true, all classes that descend from class will also be affected
**/
function uopz_add_function(string class, string function, Closure handler [, int flags = ZEND_ACC_PUBLIC [, bool all = true]]) : bool;

/**
* Add a non-existent function
* @param string function
* @param Closure handler
* @param int flags
* @param bool all
* If all is true, all classes that descend from class will also be affected
**/
function uopz_add_function(string function, Closure handler [, int flags = ZEND_ACC_PUBLIC [, bool all = true]]) : bool;

/**
* Delete a previously added method
* @param string class
* @param string function
* @param bool all
* If all is true, all classes that descend from class will also be affected
**/
function uopz_del_function(string class, string function, [, bool all = true]);

/**
* Delete a previously added function
* @param string function
**/
function uopz_del_function(string function);

/**
* Redefine $class::$constant to $value
* @param string class
* @param string constant
* @param mixed  value
* Note: only user constants should be redefined
* Note: if the constant does not exist it will be created
**/
function uopz_redefine(string class, string constant, mixed value);

/**
* Redefine $constant to $value
* @param string constant
* @param mixed  value
* Note: only user constants should be redefined
* Note: if the constant does not exist it will be created
**/
function uopz_redefine(string constant, mixed value);

/**
* Delete $class::$constant
* @param string class
* @param string constant
* Note: only user constants should be undefined
**/
function uopz_undefine(string class, string constant);

/**
* Delete $constant
* @param string constant
* Note: only user constants should be undefined
**/
function uopz_undefine(string constant);

/**
 * Get or set flags on $class::$method()
 * @param string class
 * @param string method
 * @param int flags
 */
function uopz_flags(string class, string method [, int flags]) : int;

/**
 * Get or set flags on $method()
 * @param string method
 * @param int flags
 */
function uopz_flags(string function, [, int flags]) : int;

/**
* Set instance property
* @param object instance
* @param string property
* @param mixed value
*/
function uopz_set_property(object instance, string property, mixed value);

/**
* Set static class property
* @param string class
* @param string property
* @param mixed value
*/
function uopz_set_property(string class, string property, mixed value);

/**
* Get instance property
* @param object instance
* @param string property
*/
function uopz_get_property(object instance, string property) : mixed;

/**
* Get static class property
* @param string class
* @param string property
*/
function uopz_get_property(string class, string property) : mixed;

/**
* Retrieve the last set exit() status
* Note: opcache optimizes away dead code after unconditional exit
* Note: exit() breaks xdebug hooks
*/
function uopz_get_exit_status() : mixed;

/**
* Allows control over disabled exit opcode
* @param bool allow
* Note: by default exit will be ignored
*/
function uopz_allow_exit(bool allow) : void;
```

Supported Versions
==================

[](#supported-versions)

The currently supported version of uopz is 7 which requires PHP8.0+

Testing
=======

[](#testing)

*Running the test suite*

After `make` has executed, run:

```
make test

```

You are done reading
====================

[](#you-are-done-reading)

That is all !!!

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance45

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a53e08d9e444763eaca5611e49ff1403e8e0803a648b6cbd0e3a0d33430a2ff4?d=identicon)[krakjoe](/maintainers/krakjoe)

---

Top Contributors

[![krakjoe](https://avatars.githubusercontent.com/u/2236138?v=4)](https://github.com/krakjoe "krakjoe (660 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (48 commits)")[![cmb69](https://avatars.githubusercontent.com/u/2306138?v=4)](https://github.com/cmb69 "cmb69 (30 commits)")[![nikic](https://avatars.githubusercontent.com/u/216080?v=4)](https://github.com/nikic "nikic (17 commits)")[![bwoebi](https://avatars.githubusercontent.com/u/3154871?v=4)](https://github.com/bwoebi "bwoebi (8 commits)")[![Sannis](https://avatars.githubusercontent.com/u/77367?v=4)](https://github.com/Sannis "Sannis (5 commits)")[![petk](https://avatars.githubusercontent.com/u/1614009?v=4)](https://github.com/petk "petk (4 commits)")[![weltling](https://avatars.githubusercontent.com/u/22016?v=4)](https://github.com/weltling "weltling (3 commits)")[![SMillerDev](https://avatars.githubusercontent.com/u/1484494?v=4)](https://github.com/SMillerDev "SMillerDev (3 commits)")[![tony2001](https://avatars.githubusercontent.com/u/42386?v=4)](https://github.com/tony2001 "tony2001 (3 commits)")[![michaelmoussa](https://avatars.githubusercontent.com/u/183833?v=4)](https://github.com/michaelmoussa "michaelmoussa (2 commits)")[![zonuexe](https://avatars.githubusercontent.com/u/822086?v=4)](https://github.com/zonuexe "zonuexe (1 commits)")[![dstogov](https://avatars.githubusercontent.com/u/2510034?v=4)](https://github.com/dstogov "dstogov (1 commits)")[![Girgias](https://avatars.githubusercontent.com/u/7906688?v=4)](https://github.com/Girgias "Girgias (1 commits)")[![kornrunner](https://avatars.githubusercontent.com/u/725986?v=4)](https://github.com/kornrunner "kornrunner (1 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (1 commits)")[![MingliangT](https://avatars.githubusercontent.com/u/1646738?v=4)](https://github.com/MingliangT "MingliangT (1 commits)")[![mszabo-wikia](https://avatars.githubusercontent.com/u/2721291?v=4)](https://github.com/mszabo-wikia "mszabo-wikia (1 commits)")[![rlerdorf](https://avatars.githubusercontent.com/u/54641?v=4)](https://github.com/rlerdorf "rlerdorf (1 commits)")[![asgrim](https://avatars.githubusercontent.com/u/496145?v=4)](https://github.com/asgrim "asgrim (1 commits)")

### Embed Badge

![Health badge](/badges/krakjoe-uopz/health.svg)

```
[![Health](https://phpackages.com/badges/krakjoe-uopz/health.svg)](https://phpackages.com/packages/krakjoe-uopz)
```

###  Alternatives

[bizley/contenttools

ContentTools editor implementation for Yii 2.

8016.7k](/packages/bizley-contenttools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
