1. Go to this page and download the library: Download loot/phpdoc-reader library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
loot / phpdoc-reader example snippets
$class = \App\Models\User::class;
$method = 'getChild';
$comment = (new \ReflectionMethod($class, $method))->getDocComment();
$res = new Loot\PhpDocReader\PhpDocReader($comment);
var_dump($res->getAnnotationsByName('@param'));
$comment = '
/**
* @param int $var Description
*/';
$res = new Loot\PhpDocReader\PhpDocReader($comment);
var_dump($res->getAnnotation('@param')->getDescription());
$res = new Loot\PhpDocReader\PhpDocReader('
/**
* @return int
*/');
var_dump($res->getAnnotation('@return')->getType());
$res = new Loot\PhpDocReader\PhpDocReader('
/**
* @param int $int
* @param string $string
*/');
var_dump($res->getAnnotationsByName('@param'));
$res = new Loot\PhpDocReader\PhpDocReader('
/**
* @param int $int
* @param string $string
*/');
var_dump($res->getAnnotations());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.