PHPackages                             asmblah/php-code-shift - 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. asmblah/php-code-shift

ActiveProject[Utility &amp; Helpers](/categories/utility)

asmblah/php-code-shift
======================

v0.1.20(1y ago)112.2k↓50%8MITPHPPHP &gt;=8.1

Since Aug 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/asmblah/php-code-shift)[ Packagist](https://packagist.org/packages/asmblah/php-code-shift)[ RSS](/packages/asmblah-php-code-shift/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (25)Used By (8)

PHP Code Shift
==============

[](#php-code-shift)

[![Build Status](https://github.com/asmblah/php-code-shift/workflows/CI/badge.svg)](https://github.com/asmblah/php-code-shift/actions?query=workflow%3ACI)

Allows running PHP code to be monkey-patched either ahead of time or on the fly.

Why?
----

[](#why)

To allow stubbing of built-in functions during testing, for example.

Usage
-----

[](#usage)

Install this package with Composer:

```
$ composer require asmblah/php-code-shift
```

### Hooking built-in functions

[](#hooking-built-in-functions)

`runner.php`

```
