Download the PHP package knplabs/rad-prototype without Composer
On this page you can find all versions of the php package knplabs/rad-prototype. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rad-prototype
DEPRECATED
Unfortunately we decided to not maintain this project anymore (see why). If you want to mark another package as a replacement for this one please send an email to [email protected].
Rapid Application Development : Prototype
Automatically inject methods into objects
Installation
Usages
1. Method side
You can create injectable methods via dependency injections. You can apply the tag knp_rad_prototype.prototype_method
.
For example, if I want to expose the method getRepository
form the @doctrine
service, I just have to declare a new method:
The first argument should be a service or a classname (for static methods), the second argument should be a method name. In this case, the method will be @doctrine->getRepository()
.
The alias
tag option represent the method name inside the prototype, so in this case, I can call the method with $this->getRepository()
.
Finaly, the domain
tag option represent the domain of this method, a prototype can recieve method of some domains.
2. Prototype side
2.1. Attach methods to a controller
Access to methods from a controller
Your controller should implements the Knp\Rad\Prototype\Prototype
. You can also use the basic implementation via the trait Knp\Rad\Prototype\Prototype\Controller
3. Web Debug Toolbar
When your controller implements the Knp\Rad\Prototype\Prototype
interface, the following icon will appear into the Symfony web debug toobar.
And you can also access to every accessable methods from your prototypes from the Symfony profiler interface
All versions of rad-prototype with dependencies
symfony/dependency-injection Version ~2.4||~3.0
symfony/http-kernel Version ~2.4||~3.0
doctrine/inflector Version ~1.0
phpdocumentor/reflection-docblock Version ~2.0||~3.0