PHPackages                             solution-forest/laravel-dynamic-properties - 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. solution-forest/laravel-dynamic-properties

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

solution-forest/laravel-dynamic-properties
==========================================

A fast, flexible dynamic property system for Laravel entities

v1.0.2(8mo ago)0142MITPHPPHP ^8.3CI passing

Since Aug 14Pushed 8mo agoCompare

[ Source](https://github.com/solutionforest/laravel-dynamic-properties)[ Packagist](https://packagist.org/packages/solution-forest/laravel-dynamic-properties)[ RSS](/packages/solution-forest-laravel-dynamic-properties/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Dynamic Properties
==========================

[](#laravel-dynamic-properties)

[![Tests](https://github.com/solutionforest/laravel-dynamic-properties/workflows/Tests/badge.svg)](https://github.com/solutionforest/laravel-dynamic-properties/actions)[![Code Style](https://github.com/solutionforest/laravel-dynamic-properties/workflows/Code%20Style%20(Pint)/badge.svg)](https://github.com/solutionforest/laravel-dynamic-properties/actions)[![Latest Stable Version](https://camo.githubusercontent.com/b1d841a307371ba7711c0674980dafdc4997e3486c5a5f2e1257a36de08e5def/68747470733a2f2f706f7365722e707567782e6f72672f736f6c7574696f6e2d666f726573742f6c61726176656c2d64796e616d69632d70726f706572746965732f762f737461626c65)](https://packagist.org/packages/solution-forest/laravel-dynamic-properties)[![License](https://camo.githubusercontent.com/2d52d973945f9fc4d6216fdcfbe5a3819fc7996e3ef8072f9495f5bc83647c71/68747470733a2f2f706f7365722e707567782e6f72672f736f6c7574696f6e2d666f726573742f6c61726176656c2d64796e616d69632d70726f706572746965732f6c6963656e7365)](https://packagist.org/packages/solution-forest/laravel-dynamic-properties)

A dynamic property system for Laravel that allows any entity (users, companies, contacts, etc.) to have custom properties with validation, search capabilities, and optimal performance.

Requirements
------------

[](#requirements)

- **PHP**: 8.3 or higher
- **Laravel**: 11.0 or higher
- **Database**: MySQL 8.0+ or SQLite 3.35+ (with JSON support)

Features
--------

[](#features)

- **Simple Architecture**: Clean 2-table design with optional JSON caching
- **Type Safety**: Support for text, number, date, boolean, and select properties
- **Fast Performance**: &lt; 1ms property retrieval with JSON cache, &lt; 20ms without
- **Flexible Search**: Property-based filtering with multiple operators
- **Easy Integration**: Simple trait-based implementation
- **Database Agnostic**: Works with MySQL and SQLite
- **Validation**: Built-in property validation with custom rules

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

[](#installation)

Install the package via Composer:

```
composer require solution-forest/laravel-dynamic-properties
```

Publish and run the migrations:

```
php artisan vendor:publish --provider="SolutionForest\LaravelDynamicProperties\DynamicPropertyServiceProvider" --tag="migrations"
php artisan migrate
```

Optionally, publish the configuration file:

```
php artisan vendor:publish --provider="SolutionForest\LaravelDynamicProperties\DynamicPropertyServiceProvider" --tag="config"
```

Quick Start
-----------

[](#quick-start)

> **⚠️ IMPORTANT**: You must create Property definitions before setting property values. Attempting to set a property that doesn't have a definition will throw a `PropertyNotFoundException`.

### 1. Add the Trait to Your Models

[](#1-add-the-trait-to-your-models)

```
