This library gives the capacity to implement custom annotations for PHP classes.
It extends all functionality of Doctrine/Annotations.
This library uses PHP 7.2+.
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.
The get methods by annotation allow you to retrieve the class methods that implement a particular annotation and particular parameters.
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);
Get Methods By Annotation parameters are:
class
the class object with the annotationannotation
the annotation to searchparameters
the parameters values for the annotation
Annotations library is open-source software licensed under the MIT License.