1. Go to this page and download the library: Download bfg/attributes 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 / attributes example snippets
use Bfg\Attributes\Items\AttributeClassItem;
use Bfg\Attributes\Items\AttributeConstantItem;
use Bfg\Attributes\Items\AttributeMethodItem;
use Bfg\Attributes\Items\AttributePropertyItem;
use Bfg\Attributes\Attributes;
Attributes::new(MyAttribute::class)
->map(function (AttributePropertyItem|AttributeMethodItem|AttributeClassItem|AttributeConstantItem $item) {
// Process with my attribute
});
use Bfg\Attributes\Items\AttributeClassItem;
use Bfg\Attributes\Attributes;
Attributes::new(MyAttribute::class)
->wherePath(app_path())
->map(function (AttributePropertyItem|AttributeMethodItem|AttributeClassItem|AttributeConstantItem $item) {
// Process with my attribute
});
Attributes::new(MyAttribute::class)
->wherePath(app_path())
->whereTargetClass()
->map(function (AttributeClassItem $item) {
// Process with my attribute
});
use Bfg\Attributes\Items\AttributeMethodItem;
use Bfg\Attributes\Attributes;
Attributes::new(MyAttribute::class)
->whereClass(MyAnyClassNamespace::class)
->whereTargetMethod()
->map(function (AttributeMethodItem $item) {
// Process with my attribute
});
use Bfg\Attributes\Attributes;
Attributes::new()
->wherePath(app_path())
->classes();
// In all directories
$collectionOfClasses = Attributes::new()->classes();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.