PHPackages                             performing/laravel-field-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. performing/laravel-field-attributes

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

performing/laravel-field-attributes
===================================

This is my package laravel-field-attributes

1.0.2(11mo ago)01.3k↓55.6%MITPHPPHP ^8.4CI failing

Since May 24Pushed 11mo agoCompare

[ Source](https://github.com/performingdigital/laravel-field-attributes)[ Packagist](https://packagist.org/packages/performing/laravel-field-attributes)[ Docs](https://github.com/performingdigital/laravel-field-attributes)[ RSS](/packages/performing-laravel-field-attributes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

laravel-field-attributes
========================

[](#laravel-field-attributes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b4c2b8640359ce5f6e81ed752213247437f04d7472ae4ae3700b10de9d29a2fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706572666f726d696e672f6c61726176656c2d6669656c642d617474726962757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/performingdigital/laravel-field-attributes)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a22018ee006f4052c7c9015aa198bf7a987816532c76abf165405d26d2ff1593/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706572666f726d696e676469676974616c2f6c61726176656c2d6669656c642d617474726962757465732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/performingdigital/laravel-field-attributes/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/4cb19f52a11c9ceb542c9ddb4408cf4036ff788c96b51825ee02ef969792241b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706572666f726d696e676469676974616c2f6c61726176656c2d6669656c642d617474726962757465732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/performingdigital/laravel-field-attributes/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/ef026f951b8b5741885af8b0adc04406c8bc194e62045190b97f2a9650e0b5ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706572666f726d696e672f6c61726176656c2d6669656c642d617474726962757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/performing/laravel-field-attributes)

Simple package to decorate classes with field attributes, allowing you to easily convert data objects to forms with labels and descriptions.

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

[](#installation)

You can install the package via composer:

```
composer require performing/laravel-field-attributes
```

Usage
-----

[](#usage)

```
class MyDto
{
    use FieldAttributes;

    public function __construct(
        #[Field(label: 'Name', description: 'Enter your full name')]
        public string $name,
        #[Field(label: 'Email', description: 'Enter your email address')]
        public string $email,
    ) {}
}

$instance = new MyDto('John Doe', 'john@example.com');

$instance->getFieldValues();
// ['name' => 'John Doe', 'email' => 'john@example.com']

$instance->getFieldDefinitions();
// [
//    'name' => ['label' => 'Name', 'description' => 'Enter your full name', 'type' => 'string', 'required' => true, 'value' => 'John Doe'],
//    'email' => ['label' => 'Email', 'description' => 'Enter your email address', 'type' => 'string', 'required' => true, 'value' => 'john@example.com']
// ]
```

If you combine this with [spatie/laravel-data](https://github.com/spatie/laravel-data), you can also add validation on top, serialize and deserialize as JSON back and forth from the database.

In the package there is also a caster `ObjectCast` which can cast a json column to an object, it takes the class name from a `type` column of the eloquent model. You can also map types to specifc classes in the config.

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance50

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

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

Total

3

Last Release

359d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28866565?v=4)[Giorgio Pogliani](/maintainers/giorgiopogliani)[@giorgiopogliani](https://github.com/giorgiopogliani)

---

Top Contributors

[![giorgiopogliani](https://avatars.githubusercontent.com/u/28866565?v=4)](https://github.com/giorgiopogliani "giorgiopogliani (8 commits)")

---

Tags

attributescustom fieldsfields

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/performing-laravel-field-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/performing-laravel-field-attributes/health.svg)](https://phpackages.com/packages/performing-laravel-field-attributes)
```

###  Alternatives

[jetbrains/phpstorm-attributes

PhpStorm specific attributes

41416.0M647](/packages/jetbrains-phpstorm-attributes)[vinkla/extended-acf

Register advanced custom fields with object-oriented PHP

503264.8k11](/packages/vinkla-extended-acf)[spiral/attributes

PHP attributes reader

233.6M45](/packages/spiral-attributes)[spatie/php-attribute-reader

A clean API for working with PHP attributes

80216.4k11](/packages/spatie-php-attribute-reader)[gregwar/formidable

Formidable, the pragmatic forms library

12062.2k1](/packages/gregwar-formidable)[doublesecretagency/craft-inventory

Take stock of your field usage.

70125.6k1](/packages/doublesecretagency-craft-inventory)

PHPackages © 2026

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