https://github.com/markuszeller/php-annotations
This class helps reading annotations.
https://github.com/markuszeller/php-annotations
annotations composer package parser php
Last synced: 5 months ago
JSON representation
This class helps reading annotations.
- Host: GitHub
- URL: https://github.com/markuszeller/php-annotations
- Owner: markuszeller
- Created: 2019-08-04T18:13:22.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-04T18:19:30.000Z (almost 7 years ago)
- Last Synced: 2025-10-09T13:54:17.617Z (9 months ago)
- Topics: annotations, composer, package, parser, php
- Language: PHP
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-annotations
This class helps reading annotations.


## Features
- reads from a string
- reads from a file
- supports multiline annotation values
- auto trims values
## Note
Reads only annotations from DocComments included in `/** [...] */`.
Look into that **double asterisk**.
## Usage
Initialise an Annotation object
require_once '../vendor/autoload.php';
use markuszeller\Annotations\Reader;
$reader = new Reader();
Put some data into the annotation reader instance
* by a string
$cssString = file_get_contents('./template.css');
$reader->loadFromString($cssString);
* by file
if($reader->loadFromFile("./example.css") === false) {
exit("Error loading file");
}
Get all the annotations as an associative array
$annotationArray = $reader->getAnnotations();
Get a single annotation by name
$title = $reader->getAnnotation('title');