crazyfactory / docblocks
A library for parsing and working with php docblocks from within your code.
Requires
- php: >=7.1.0
Requires (Dev)
- phpunit/phpunit: 5.5.*
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2024-12-09 13:59:23 UTC
README
Parses php doc blocks and makes them easily accessible.
This is based on using reflection and results should be heavily cached or only be used in processes which aren't time critical.
Install
Run composer require crazyfactory/docblocks
to install the latest version into your composer powered project.
Usage
You can pass in any doc-block formatted string into the constructor of DocBlock to have it parsed.
$dc = new DocBlock('/** myDocBlockString */');
Or you can pass in any Reflection object offering getDocComment() like ReflectionMethod, ReflectionClass etc.
$dc = new DocBlock(new \ReflectionClass(MyClass::class));
If you only care for the results in form of simple DocBlockParameter-array you can use the parser directly.
$results = DocBlock::parse($myDocBlockString);
Changelog
- 2.0.0 added auto-deploy via travis CI with githubtags as version-nr.