PHPackages                             ondrejmirtes/composer-attribute-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. ondrejmirtes/composer-attribute-collector

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

ondrejmirtes/composer-attribute-collector
=========================================

A convenient and near zero-cost way to retrieve targets of PHP 8 attributes

1.1.1(11mo ago)62.3M—2.7%2BSD-3-ClausePHPPHP ^7.4 || ^8.0CI passing

Since May 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/ondrejmirtes/composer-attribute-collector)[ Packagist](https://packagist.org/packages/ondrejmirtes/composer-attribute-collector)[ RSS](/packages/ondrejmirtes-composer-attribute-collector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

composer-attribute-collector
============================

[](#composer-attribute-collector)

[![Release](https://camo.githubusercontent.com/a30072af1cde095409c59b484c175fda36e04c8c0edccaa777f7260708a33c3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e6472656a6d69727465732f636f6d706f7365722d6174747269627574652d636f6c6c6563746f722e737667)](https://packagist.org/packages/olvlvl/composer-attribute-collector)[![Code Coverage](https://camo.githubusercontent.com/65ca28c2e89479da47af15755f2b954439ad7df6411ad216536274f5ad6c9597/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f6e6472656a6d69727465732f636f6d706f7365722d6174747269627574652d636f6c6c6563746f722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/r/ondrejmirtes/composer-attribute-collector?branch=main)[![Downloads](https://camo.githubusercontent.com/9c3e35cb79ff23db470b383a9210fb9938e75750ac5f4dedfb1e276dc9ef006d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e6472656a6d69727465732f636f6d706f7365722d6174747269627574652d636f6c6c6563746f722e737667)](https://packagist.org/packages/olvlvl/composer-attribute-collector)

**composer-attribute-collector** is a plugin for [Composer](https://getcomposer.org/). Its ambition is to provide a convenient way—and near zero cost—to retrieve targets of PHP 8 attributes. After the autoloader has been dumped, the plugin collects attribute targets and generates a static file. These targets can be retrieved through a convenient interface, without reflection. The plugin is useful when you need to *discover* attribute targets in a codebase—for known targets you can use reflection.

#### Features

[](#features)

- Little configuration
- No reflection in the generated file
- No impact on performance
- No dependency (except Composer of course)
- A single interface to get attribute targets: classes, methods, and properties
- Can cache discoveries to speed up consecutive runs.

Note

Currently, the plugin supports class, method, and property targets. You're welcome to [contribute](CONTRIBUTING.md) if you're interested in expending its support.

#### Usage

[](#usage)

The following example demonstrates how targets and their attributes can be retrieved:

```
