devsdmf/annotations

A simple and directly handler for docblock and annotations for PHP

1.0.1 2020-01-03 19:09 UTC

This package is auto-updated.

Last update: 2024-03-29 03:12:54 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight

A simple and directly handler for docblock and annotations for PHP

Installation

Just add the following dependency line to your composer.json file:

{
    "require": {
        "devsdmf/annotations": "1.*"
    }
}

Usage

use Devsdmf\Annotations\Reader;
use ReflectionClass;

$reflector = new ReflectionClass('MyClass');
$reader = new Reader();

$annotation = $reader->getClassAnnotations($reflector);

The example above work with the most of Reflector interface implementations, see the available adapters below.

Adapters

  • ReflectionClass
  • ReflectionFunction
  • ReflectionMethod
  • ReflectionObject
  • ReflectionProperty

Tests

To run the test suite, you need install the require-dev dependencies:

$ composer install --dev
$ ./vendor/bin/phpunit

License

This library is licensed under the MIT license.