Download the PHP package pugx/aop without Composer
On this page you can find all versions of the php package pugx/aop. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package aop
PUGX/AOP
This library aims to provide a very simple and lightweight support for Aspect-Oriented Programming in PHP frameworks and libraries.
It basically provides a layer to compile aspects in classes exposed as services in a dependency injection container.
Development
AOP is currently under development, so it is not recommended for production environments.
In the pipeline, we have the following ideas:
- evaluate how to integrate with the code/concepts provided in JMSAopBundle
- support static compilation of the container (for example, before deployments)
- caching
- covering the library with more and more unit tests
- writing compilers for more DICs
This library is experimental: we need to get our heads around the idea of AOP implemented in this way before going further with it. Development, in any case, is active.
Supported containers
Here is a list of the supported DICs:
Available aspects
Here is a list of available aspects:
Installation
Installation should be done via composer.
Here's the link of the package on Packagist.
Examples
Here is a brief recap of how to integrate AOP in your
own code - you can also have a look at the scripts
provided in the examples
directory.
That's it, now you have successfully compiled your DIC with AOP.
As you probably noticed, we passed an empty array representing the list of aspects. Read on to understand how to actually inject aspects in the container's services.
Loggable
Here is how you enable the Loggable
aspect:
Now, let's see how the DIC is configured:
At this point you just need to add the annotations
to enable Loggable in the service my_example_service
:
At the end, you just need to run the code
to see that Monolog
is actually logging
thanks to the Loggable aspect: