PHPackages                             mcannucci/aspect-override - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. mcannucci/aspect-override

ActiveLibrary[Testing &amp; Quality](/categories/testing)

mcannucci/aspect-override
=========================

Override functions through aspects

0.5.0(3y ago)12481MITPHPPHP ^7.1 | ^8

Since Dec 28Pushed 2y agoCompare

[ Source](https://github.com/MichaelCannucci/aspect-override)[ Packagist](https://packagist.org/packages/mcannucci/aspect-override)[ RSS](/packages/mcannucci-aspect-override/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (12)Used By (1)

Aspect Override
===============

[](#aspect-override)

**This library is experimental until version 1.0.0 and may break on updates**

Override methods (Through an aspect oriented approach) and functions within your PHP tests

**Note**: This library is only intended to be used in your testing environment and has no guarantees of stability in production environments

About
-----

[](#about)

This library aims to be the 'swiss army knife' of being able to test any PHP project by allowing you to modify the execution of the program however you wish.

Features
--------

[](#features)

- Overwrite any type of class method static or non-static
- Overwrite the functionality of any function whether it's namespaced or global
- Overwrite the arguments of a function before it's called
- Overwrite the return of a function after it's called
- Modify function arguments even if they are passed by reference
- Framework and autoloader agnostic, works with any PHP codebase (ex: Composer, regular require path/to/my/code.php)

Getting Started
---------------

[](#getting-started)

### Installing

[](#installing)

```
composer require --dev mcannucci/aspect-override

```

Bootstrapping
-------------

[](#bootstrapping)

To enable overwriting function and class method, AspectOverride needs to initialize some stream processors to perform the code transformations that enable the class method and function rewriting

```
