Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phpDocumentor/ReflectionDocBlock
https://github.com/phpDocumentor/ReflectionDocBlock
docblocks
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/phpDocumentor/ReflectionDocBlock
- Owner: phpDocumentor
- License: mit
- Created: 2012-04-06T17:17:37.000Z (over 12 years ago)
- Default Branch: 5.x
- Last Pushed: 2024-08-14T20:00:44.000Z (4 months ago)
- Last Synced: 2024-10-29T19:22:06.350Z (about 1 month ago)
- Topics: docblocks
- Language: PHP
- Homepage:
- Size: 1.28 MB
- Stars: 9,351
- Watchers: 20
- Forks: 119
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- php-awesome - ReflectionDocBlock - PHP 注释块解析 (类库 / 语法解析)
README
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Qa workflow](https://github.com/phpDocumentor/ReflectionDocBlock/workflows/Qa%20workflow/badge.svg)
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master)
[![Stable Version](https://img.shields.io/packagist/v/phpdocumentor/reflection-docblock.svg)](https://packagist.org/packages/phpdocumentor/reflection-docblock)
[![Unstable Version](https://img.shields.io/packagist/vpre/phpdocumentor/reflection-docblock.svg)](https://packagist.org/packages/phpdocumentor/reflection-docblock)ReflectionDocBlock
==================Introduction
------------The ReflectionDocBlock component of phpDocumentor provides a DocBlock parser
that is 100% compatible with the [PHPDoc standard](http://phpdoc.org/docs/latest).With this component, a library can provide support for annotations via DocBlocks
or otherwise retrieve information that is embedded in a DocBlock.Installation
------------```bash
composer require phpdocumentor/reflection-docblock
```Usage
-----In order to parse the DocBlock one needs a DocBlockFactory that can be
instantiated using its `createInstance` factory method like this:```php
$factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
```Then we can use the `create` method of the factory to interpret the DocBlock.
Please note that it is also possible to provide a class that has the
`getDocComment()` method, such as an object of type `ReflectionClass`, the
create method will read that if it exists.```php
$docComment = <<create($docComment);
```The `create` method will yield an object of type `\phpDocumentor\Reflection\DocBlock`
whose methods can be queried:```php
// Contains the summary for this DocBlock
$summary = $docblock->getSummary();// Contains \phpDocumentor\Reflection\DocBlock\Description object
$description = $docblock->getDescription();// You can either cast it to string
$description = (string) $docblock->getDescription();// Or use the render method to get a string representation of the Description.
$description = $docblock->getDescription()->render();
```> For more examples it would be best to review the scripts in the [`/examples` folder](/examples).