Skip to content

Annotations are a mechanism for adding metadata information to source code.

License

Notifications You must be signed in to change notification settings

danineto/annotations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Annotations

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 annotation
  • annotation the annotation to search
  • parameters the parameters values for the annotation

License

Annotations library is open-source software licensed under the MIT License.

About

Annotations are a mechanism for adding metadata information to source code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages