PHPackages                             aw-studio/laravel-dynamic-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. aw-studio/laravel-dynamic-attributes

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

aw-studio/laravel-dynamic-attributes
====================================

v0.1.0(4y ago)213MITPHP

Since Oct 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/aw-studio/laravel-dynamic-attributes)[ Packagist](https://packagist.org/packages/aw-studio/laravel-dynamic-attributes)[ RSS](/packages/aw-studio-laravel-dynamic-attributes/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Dynamic Attributes
==========================

[](#laravel-dynamic-attributes)

A package for adding dynamic attributes to [Elqouent Models](https://laravel.com/docs/eloquent).

See also: [Laravel Dynamic Relations](https://github.com/aw-studio/laravel-dynamic-relations)

Setup
-----

[](#setup)

Install the package via composer:

```
composer require aw-studio/laravel-dynamic-attributes
```

Publish the migrations:

```
php artisan vendor:publish --tag="dynamic-attributes:migrations"
```

Usage
-----

[](#usage)

Just add the `HasDynamicAttributes` to a Model:

```
use Illuminate\Database\Eloquent\Model;
use AwStudio\DynamicAttributes\HasDynamicAttributes;

class Page extends Model
{
    use HasDynamicAttributes;
}
```

And voila:

```
$page = Page::create([
    'headline' => 'Hello World!',
    'text'     => 'Lorem Ipsum...',
]);

echo $page->headline; // "Hello World!"
```

### Set Attribute Cast Manually

[](#set-attribute-cast-manually)

Usually casts should be set correctly depending on the attribute value:

```
Page::create(['released_at' => now()->addWeek()]);

dd($page->released_at); // Is an instance of Illuminate\Support\Carbon
```

However you may want to set an attribute cast manually:

```
$page = Page::create(['is_active' => 1]);

dump($page->is_active); // output: 1

$page->setDynamicAttributeCast('is_active', 'boolean')->save();

dd($page->is_active); // output: true
```

### Query Scopes

[](#query-scopes)

```
Page::whereAttribute('foo', 'bar');
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

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

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1665d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b2d65d58480dd7fdbf4f4593158cbd0634550ee9210c49957cc48c8a8ccaef6?d=identicon)[jannescb](/maintainers/jannescb)

---

Top Contributors

[![cbl](https://avatars.githubusercontent.com/u/29352871?v=4)](https://github.com/cbl "cbl (7 commits)")[![jannescb](https://avatars.githubusercontent.com/u/17292622?v=4)](https://github.com/jannescb "jannescb (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aw-studio-laravel-dynamic-attributes/health.svg)

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

###  Alternatives

[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[illuminate/redis

The Illuminate Redis package.

8314.0M314](/packages/illuminate-redis)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)

PHPackages © 2026

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