PHP code example of bfg / doc

1. Go to this page and download the library: Download bfg/doc 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/ */

    

bfg / doc example snippets


/**
 * @props string $type Doc var type: "@method" 
 * @props array|string|null $var_type Doc type of var
 * @props string|null $name Doc name of var
 * @props string|null $description Doc description of the var
 */
use Bfg\Doc\Attributes\Doc($type, $var_type, $name|null, $description|null);

/**
 * @props string $name Class namespace for mixin helper
 */
use Bfg\Doc\Attributes\DocClassName($name);

// To generate method helpers
use Bfg\Doc\Attributes\DocMethods($var_type, $name|null, $description|null);

// To generate property helpers
use Bfg\Doc\Attributes\DocProperties($var_type, $name|null, $description|null);

// To generate method helpers from array
use Bfg\Doc\Attributes\DocMethodsFromArray($var_type, $description|null);

// To generate property helpers from array
use Bfg\Doc\Attributes\DocPropertiesFromArray($var_type, $description|null);

use Bfg\Doc\Attributes\DocMethodsFromArray;
use Bfg\Doc\Attributes\DocPropertiesFromArray;
use Bfg\Doc\Attributes\DocClassName;

/**
 * Class PropsData
 * 
 * Result:
 * @method PropsData|static test() From inputs property for test method
 * @[type] [var_type]       [name] [description]
 * @property-read PropsData $simple_form
 * @[type]       [var_type] [name]
 *
 * And if you want you can add the "DocClassName" and created this class like mixin
 * @mixin \Bfg\Doc\Attributes\PropDataBlocks
 */
class PropsData
{
    /**
     * @var array|string[]
     */
    #[DocMethodsFromArray(['{value}', 'static'], 'From {name} property for {key} method')]
    static array $inputs = [
        'test' => PropsData::class
    ];

    /**
     * @var array|string[]
     */
    #[DocPropertiesFromArray]
    protected array $forms = [
        'simple_form' => PropsData::class
    ];

    /**
     * @var array|string[]
     */
    #[DocPropertiesFromArray, DocClassName('PropDataBlocks')]
    protected array $blocks = [
        'simple_block' => PropsData::class
    ];
}
bash
php artisan make:docs
bash
composer dump-autoload