Download the PHP package jmacedo/php-simple-annotation without Composer
On this page you can find all versions of the php package jmacedo/php-simple-annotation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jmacedo/php-simple-annotation
More information about jmacedo/php-simple-annotation
Files in jmacedo/php-simple-annotation
Package php-simple-annotation
Short Description Yet another PHP annotation implementation. A simple and direct implementation without any complexity.
License MIT
Homepage https://github.com/jmacedo/php-simple-annotation
Informations about the package php-simple-annotation
PHP Simple Annotation
Yet another PHP annotation implementation. A simple and direct implementation without any complexity.
Requirements
- PHP >= 7.4.*
- ext-json
- ext-mbstring
Installation
Usage
Consider the following class for the purpose of this documentation:
You can instantiate the Annotation class in two ways:
-
First:
- Second:
To get class annotations:
The class implements and magic methods, so to access the annotations keys, just access the properties:
To get methods annotations:
For a specific method:
To get properties annotations:
For a specific property:
And that's it
Just instantiate the class, call the methods and use the annotations values of the class you want to.
Cache
By default, there is no cache in use, but there is a cache handler implemented that can be used, if you want.
This cache handler uses a file approach and had good results in some simple benchmarks I have made:
For :
For :
For :
The concrete implementation of must implement the interface to the implementation work well.
If you use the default implementation of this library, you don't have to worry about it.
All versions of php-simple-annotation with dependencies
ext-json Version *
ext-mbstring Version *