Download the PHP package linusshops/self-modifying-code without Composer
On this page you can find all versions of the php package linusshops/self-modifying-code. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download linusshops/self-modifying-code
More information about linusshops/self-modifying-code
Files in linusshops/self-modifying-code
Package self-modifying-code
Short Description Runtime modification of class definitions
License MIT
Homepage https://github.com/linusshops/self-modifying-code
Informations about the package self-modifying-code
Self Modifying Code (SMC)
Requires Runkit and Reflection
SMC provides a convenient way to reload functionality while you are in a REPL or debug console.
Ever test something in the console, and realize while you're debugging what needs to be changed? Normally, you'd have to terminate the session, losing any accumulated context from your console session. SMC allows you to reload a class or method definition in mid-execution (similar to REPL environments provided by lisp and clojure).
Due to a limitation in runkit, if you are currently executing a class, you cannot reload the whole thing. However, you can reload individual methods as well.
:fire::fire::fire::fire::fire::fire:
This is ONLY intended to be used as a debugging aid or in a REPL environment.
If you are using this to implement functionality, you need to seriously re-evaluate your decisions.
:fire::fire::fire::fire::fire::fire:
Installation
If runkit is not installed, install it with pecl install runkit
.
Add linusshops/self-modifying-code
to your composer.json.
Usage
All reload methods return a boolean indicating if SMC was able to redefine the requested identifier.
All reload methods are able to accept either a string class definition, or an instance of the class itself.