Download the PHP package bfg/doc without Composer
On this page you can find all versions of the php package bfg/doc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package doc
Short Description Php doc block generator
License MIT
Homepage https://github.com/bfg/doc
Informations about the package doc
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?
Its main purpose is to use it to describe your magic methods or properties that are accumulated in the properties of the class.
Install
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
In total, for generating helpers, I created 2 main attributes:
The first attribute Bfg\Doc\Attributes\Doc
is needed just to designate a property
that will extend the capabilities of the class.
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:
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
Run
To start the generator, just call the artisan command:
or