PHPackages                             bfg/doc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bfg/doc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bfg/doc
=======

Php doc block generator

1.0.3(2y ago)156.7k—8.7%11MITPHPPHP ^8.0

Since Jun 23Pushed 2y ago2 watchersCompare

[ Source](https://github.com/bfg-s/doc)[ Packagist](https://packagist.org/packages/bfg/doc)[ Docs](https://github.com/bfg/doc)[ RSS](/packages/bfg-doc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (1)

Doc Package
===========

[](#doc-package)

A system for describing the behavior of classes where magic methods are used so as not to lose connection with the classes.

What is it for?
---------------

[](#what-is-it-for)

Its main purpose is to use it to describe your magic methods or properties that are accumulated in the properties of the class.

Install
-------

[](#install)

```
composer require bfg/doc
```

Principle of operation
----------------------

[](#principle-of-operation)

For a convenient description of properties, I wrote this logic on the attribute system that was added to php 8.

The kernel searches for files in all project folders, except for the following: `{base_path}/public`, `{base_path}/vendor`, `{base_path}/routes`, `{base_path}/resources`, `{base_path}/storage`, `{base_path}/runtimes`, `{base_path}/database`.

And it ignores all named folders: `node_modules`, `css`, `js`.

Searches for files with the `*.php` extension and checks for the existence of a class in the file.

> To avoid difficulties, it is necessary to create a separate file for each class.

Usage
-----

[](#usage)

In total, for generating helpers, I created 2 main attributes:

```
/**
 * @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);
```

The first attribute `Bfg\Doc\Attributes\Doc` is needed just to designate a property that will extend the capabilities of the class.

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

The second attribute `Bfg\Doc\Attributes\DocClassName` is needed to indicate the name of the class into which these properties will be added.

> This can be useful if you are making a package that can extend its properties as needed.

I also added several aliases for the `Bfg\Doc\Attributes\Doc` attribute:

```
// 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);
```

Macro strings:

- Global:
    - {name} - The name of variable
- Array:
    - {key} - Key of array
    - {value} - Value of array
- Variable:
    - {value} - Value of variable
    - {type} - Type of variable
    - {value\_construct} - The value class construct props
- Class name:
    - {class} - The name of class
    - {namespace} - The namespace of class

Example
-------

[](#example)

```
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
    ];
}
```

Run
---

[](#run)

To start the generator, just call the artisan command:

```
php artisan make:docs
```

or

```
composer dump-autoload
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~232 days

Total

4

Last Release

1092d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59b2d162a30938ac2c3c56340ebea07a6778a3e1c86cb70b5bc28b69a1c3f04d?d=identicon)[bfg](/maintainers/bfg)

---

Top Contributors

[![Xsaven](https://avatars.githubusercontent.com/u/1726771?v=4)](https://github.com/Xsaven "Xsaven (11 commits)")

---

Tags

laraveldocblock

### Embed Badge

![Health badge](/badges/bfg-doc/health.svg)

```
[![Health](https://phpackages.com/badges/bfg-doc/health.svg)](https://phpackages.com/packages/bfg-doc)
```

###  Alternatives

[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
