danineto / annotations
Annotations are a mechanism for adding metadata information to source code.
Requires
- php: >=7.2
- doctrine/annotations: ^1.6
Requires (Dev)
- phpunit/phpunit: ^8.2
This package is auto-updated.
Last update: 2025-05-29 01:24:31 UTC
README
This library gives the capacity to implement custom annotations for PHP classes.
It extends all functionality of Doctrine/Annotations.
Requirements
This library uses PHP 7.2+.
Installation
It is recommended that you install the library throught composer.
To do so, run the Composer command to install the latest stable version:
composer require danineto/annotations
If not using composer you must also include this library: Doctrine/Annotations.
Get Methods by Annotation
The get methods by annotation allow you to retrieve the class methods that implement a particular annotation and particular parameters.
Example using the AsMethod annotation
use Danineto\Annotations\AsMethod; use Danineto\Annotations\Common\AnnotationReader; $class = new class { /** * @AsMethod(name="getExample") */ function method() { return true; } }; $reader = new AnnotationReader() $methods = $reader->getMethodByAnnotation($class, AsMethod::class, [ 'name' => 'getExample' ]); var_dump($methods);
Parameters
Get Methods By Annotation parameters are:
class
the class object with the annotationannotation
the annotation to searchparameters
the parameters values for the annotation
License
Annotations library is open-source software licensed under the MIT License.