Download the PHP package mcannucci/aspect-override without Composer

On this page you can find all versions of the php package mcannucci/aspect-override. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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

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

Getting Started

Installing

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

Usage

Overwriting class methods

Overwriting class methods arguments before running

Overwriting specific class methods arguments before running

Overwriting a method's return value

Overwriting a function's return value

Questions you might have

Q: How does this work, I thought you can't redefine method and function in PHP?

A: When a file is loaded in PHP it passes through PHP's streams and since PHP supports wrappers around streams we can rewrite the code to include the overwrite functionality before PHP executes it

Q: This library is really weird and I hate it, why don't you test code normally?

A: I wish all the codebases I work on are testable 😈

Q: Why don't line numbers match or step over requires multiple clicks up when step debugging

A: Since we're rewriting the source code to rewrite methods and functions. statements get inserted to return early with another value, replace arguments and or call and return the result of 'rewritten' function. This seemed to be better than having to step debug overwritten code (If possible)

Versioning

SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgements

Functionality Heavily inspired by AspectMock and Heavily Inspired by php-vcr for monkey-patching through PHP streams


All versions of aspect-override with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 | ^8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mcannucci/aspect-override contains the following files

Loading the files please wait ....