PHPackages                             yarfox/attributes-collector - 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. yarfox/attributes-collector

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

yarfox/attributes-collector
===========================

PHP8 Attribute Collector.

317PHP

Since Jul 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yarfox/attributes-collector)[ Packagist](https://packagist.org/packages/yarfox/attributes-collector)[ RSS](/packages/yarfox-attributes-collector/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

attributes-collector (annotations-collector)
============================================

[](#attributes-collector-annotations-collector)

PHP8 attribute collector.

### Required

[](#required)

- php&gt;=8

### Install

[](#install)

```
composer require yarfox/attributes-collector
```

### Usage

[](#usage)

1. Install
2. Add php file `AttributeConfig.php` to your project.

```
class AttributeConfig implements ConfigInterface
{
    #[ArrayShape(['scanDirs' => 'array'])]
    public static function getAttributeConfigs(): array
    {
        return [
            'scanDirs' => [
                __NAMESPACE__ => __DIR__,
            ],
        ];
    }
}
```

3. Add attribute and attribute handler.

```
// Attribute
#[Attribute(Attribute::TARGET_CLASS)]
class ClassAttribute
{
    public const TEST = 'test';

    private string $test;

    public function __construct(#[ExpectedValues(valuesFromClass: ClassAttribute::class)] string $test)
    {
        $this->test = $test;
    }

    public function getTest(): string
    {
        return $this->test;
    }
}

// AttributeHandler
#[AttributeHandler(ClassAttribute::class)]
class ClassAttributeHandler extends AbstractHandler
{
    public function handle(): void
    {
        /**
         * @var $attribute ClassAttribute
         */
        var_dump($this);
        $attribute = $this->attribute;
        var_dump($attribute->getTest());
    }
}
```

4. Use Attribute

```
#[ClassAttribute(ClassAttribute::TEST)]
class ClassAttributeTest
{

}
```

5. Start scan.

```
AttributeKeeper::bootloader();
AttributeKeeper::collect();
```

### Example

[](#example)

[attributes-collector-example](https://github.com/yarfox/attributes-collector-example)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.5% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27605589?v=4)[anhoder](/maintainers/anhoder)[@anhoder](https://github.com/anhoder)

---

Top Contributors

[![anhoder](https://avatars.githubusercontent.com/u/27605589?v=4)](https://github.com/anhoder "anhoder (39 commits)")[![anhoderai](https://avatars.githubusercontent.com/u/125627975?v=4)](https://github.com/anhoderai "anhoderai (1 commits)")

---

Tags

annotation-processorannotationsattributeattributesphpphp8

### Embed Badge

![Health badge](/badges/yarfox-attributes-collector/health.svg)

```
[![Health](https://phpackages.com/badges/yarfox-attributes-collector/health.svg)](https://phpackages.com/packages/yarfox-attributes-collector)
```

###  Alternatives

[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

34010.4M15](/packages/winzou-state-machine-bundle)[xethron/laravel-4-generators

Rapidly generate resources, migrations, models, and much more.

972.8M10](/packages/xethron-laravel-4-generators)[timacdonald/has-parameters

A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.

228271.7k2](/packages/timacdonald-has-parameters)[cornernote/gii-modeldoc-generator

Gii ModelDoc Generator for Yii framework

13109.1k](/packages/cornernote-gii-modeldoc-generator)[vanthao03596/laravel-hanhchinhvn

hành chính việt nam laravel

406.3k](/packages/vanthao03596-laravel-hanhchinhvn)

PHPackages © 2026

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