PHPackages                             constup-foss/php-attributes - 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. constup-foss/php-attributes

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

constup-foss/php-attributes
===========================

A collection of PHP attributes and their processors.

3.5.0(1w ago)410↓62.5%MITPHPPHP &gt;=8.5

Since May 20Pushed 1w agoCompare

[ Source](https://github.com/constup-foss/php-attributes)[ Packagist](https://packagist.org/packages/constup-foss/php-attributes)[ Fund](https://www.buymeacoffee.com/puew3hvwvp)[ Patreon](https://www.patreon.com/c/NikolaStojiljkovic)[ RSS](/packages/constup-foss-php-attributes/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (8)Versions (15)Used By (0)

constUP PHP Attributes
======================

[](#constup-php-attributes)

Table of Contents

- [Description](#description)
    - [Libraries that use `constup-foss/php-attributes`](#libraries-that-use-constup-fossphp-attributes)
- [Supporting development](#supporting-development)
- [Installation](#installation)
- [Available attributes](#available-attributes)
- [Common attribute processors](#common-attribute-processors)
- [License](#license)
- [Supporting development](#supporting-development-1)

[![Static Badge](https://camo.githubusercontent.com/b0fbf30db00a472955b7eecc73201f53666af84973bf759bd15cde881ff4ce0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352d626c7565)](https://camo.githubusercontent.com/b0fbf30db00a472955b7eecc73201f53666af84973bf759bd15cde881ff4ce0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352d626c7565)[![Static Badge](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)[![Packagist Downloads](https://camo.githubusercontent.com/ab86be0662fde180e7efcd678147ce5f112b2c916442df67f20df793e5294ef2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e737475702d666f73732f7068702d61747472696275746573)](https://camo.githubusercontent.com/ab86be0662fde180e7efcd678147ce5f112b2c916442df67f20df793e5294ef2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e737475702d666f73732f7068702d61747472696275746573)

Description
-----------

[](#description)

A collection of PHP attributes and their processors. Includes reusable common processors that can be used on any attribute, even your own.

The main idea behind several attributes in this library is to leverage First Class Callables in static expressions ([PHP RFC Wiki](https://wiki.php.net/rfc/fcc_in_const_expr)) introduced in PHP 8.5. FCCs allow you to have attributes whose arguments are not static, but rather resolved during runtime. This removes the clutter of having multiple distinct attributes to cover the same base functionality, for example, validation.

Of course, since this approach has its benefits and downsides, this library contains classic attributes with static arguments as well. You are free to use the ones that are the best fit for your use case.

### Libraries that use `constup-foss/php-attributes`

[](#libraries-that-use-constup-fossphp-attributes)

-  - `constup-foss/php-serializer` is a PHP serializer, deserializaer, normalizer and denormalizer library that uses attributes supporting FCCs. The library is currently in active development and is not production-ready.

Supporting development
----------------------

[](#supporting-development)

If you like this library or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source.

[![bmac](doc/bmac.png)](doc/bmac.png)

[![default green](https://camo.githubusercontent.com/6d00276d6e09b1c1a8391562c40e2c387f266c3518fdb25a19429d30aa22ef7a/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d677265656e2e706e67)](https://www.buymeacoffee.com/puEW3HvWvP)

Installation
------------

[](#installation)

```
composer require constup-foss/php-attributes
```

Available attributes
--------------------

[](#available-attributes)

```
#[DoNotSerialize]
#[TransformPropertyName(\Closure $transformer)]
#[TransformPropertyValue(\Closure $transformer)]
#[ValidateProperty(\Closure $validator)]
```

More detailed list of available attributes, their processors and links to individual documentation pages is available here: [Available attributes](doc/available_attributes.adoc)

Common attribute processors
---------------------------

[](#common-attribute-processors)

Common attribute processors implemented in this library can be used directly to process attributes of a specific structure (the number and type of arguments that an Attribute has). Many concrete Attribute processors in this library are just extensions of the common ones.

Important

Common attribute processors can be used on **any** attribute that satisfies supported attribute structure. They can be used on attributes that are not part of this library.

You are free to use them on third-party attributes or even on your own attributes.

The list of available common attribute processors is avaliable on a separate page: [Common attribute processors](doc/common_attribute_processors.adoc).

License
-------

[](#license)

MIT License

- License file: [LICENSE.txt](LICENSE.txt)
- Online version:

Supporting development
----------------------

[](#supporting-development-1)

If you like this library or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source.

[![bmac](doc/bmac.png)](doc/bmac.png)

[![default green](https://camo.githubusercontent.com/6d00276d6e09b1c1a8391562c40e2c387f266c3518fdb25a19429d30aa22ef7a/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d677265656e2e706e67)](https://www.buymeacoffee.com/puEW3HvWvP)

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance98

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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 ~1 days

Total

13

Last Release

12d ago

Major Versions

1.1.1 → 2.0.02026-05-26

2.0.0 → 3.0.02026-05-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ff6a24d0a2201cc6237bc92b6cd2025fbfaea471e35ded103e14a8ebf894bc0?d=identicon)[constup-foss](/maintainers/constup-foss)

---

Top Contributors

[![constup-foss](https://avatars.githubusercontent.com/u/286199137?v=4)](https://github.com/constup-foss "constup-foss (46 commits)")

---

Tags

composercomposer-librarycomposer-packagephpphp-85php-attributephp-attributes

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/constup-foss-php-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/constup-foss-php-attributes/health.svg)](https://phpackages.com/packages/constup-foss-php-attributes)
```

PHPackages © 2026

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