Download the PHP package asmblah/php-code-shift without Composer

On this page you can find all versions of the php package asmblah/php-code-shift. 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 php-code-shift

PHP Code Shift

Build Status

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

Why?

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

Usage

Install this package with Composer:

Hooking built-in functions

runner.php

substr_test.php

The output will be:

Hooking classes

References to a class may be replaced with references to a different class. This only works for statically-referenced classes, i.e. where it is referenced with a bareword, e.g. new MyClass.

Dynamic/variable references are not supported, e.g. new $myClassName as they can only be resolved at runtime.

Any matching types are not replaced - the replacement class must extend the original class or interface in order to pass type checks.

runner.php

class_test.php

The output will be:

Static method calls (MyClass::myStaticMethod()) and class constant fetches (MyClass:MY_CONST) are also supported.

Custom stream handlers

Filesystem access is intercepted using a stream wrapper for the special file:// and phar:// protocols. By default, the stream wrapper uses a stream handler (a PHP Code Shift -specific concept) that for the most part delegates to PHP's native filesystem handling. A custom stream handler may be registered in its place in order to hook into filesystem operations.

See Nytris Antilag and Nytris Boost for examples of libraries that register custom stream handlers.

Example

Limitations

Functionality is extremely limited at the moment, you may well be better off using one of the alternatives listed in See also below.

See also


All versions of php-code-shift with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
nikic/php-parser Version ^4.18 || ^5.0
nytris/nytris Version ^0.1
psr/log Version ^1|^2|^3
symfony/filesystem Version ^5.4
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 asmblah/php-code-shift contains the following files

Loading the files please wait ....