PHPackages                             ivanmercedes/flex-fields - 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. [Admin Panels](/categories/admin)
4. /
5. ivanmercedes/flex-fields

ActiveLibrary[Admin Panels](/categories/admin)

ivanmercedes/flex-fields
========================

ACF-like Custom Entities &amp; Custom Fields plugin for Laravel + Filament

0.3.1(2w ago)8125↓50%1MITPHPPHP ^8.3CI passing

Since Jul 8Pushed 2w agoCompare

[ Source](https://github.com/ivanmercedes/flex-fields)[ Packagist](https://packagist.org/packages/ivanmercedes/flex-fields)[ RSS](/packages/ivanmercedes-flex-fields/feed)WikiDiscussions main Synced 1w ago

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

FlexFields — Dynamic Entities &amp; Custom Fields for Filament
==============================================================

[](#flexfields--dynamic-entities--custom-fields-for-filament)

[![Latest Version on Packagist](https://camo.githubusercontent.com/85f6234036fa30872182801bc12460a821760209835e16c12a55907e8c601338/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976616e6d657263656465732f666c65782d6669656c64732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanmercedes/flex-fields)[![Total Downloads](https://camo.githubusercontent.com/bd3298716d74f8d08a12e21afc7390d414ef9719ffb002f8d944aa215870c286/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976616e6d657263656465732f666c65782d6669656c64732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanmercedes/flex-fields)[![License](https://camo.githubusercontent.com/c4aa6edafe1d3736a7515cd64491cf1188e0717a18dee59af53b1c4fee7e76c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6976616e6d657263656465732f666c65782d6669656c64732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanmercedes/flex-fields)[![PHP version support](https://camo.githubusercontent.com/eaa919b762d1c6f6ca77c3278d5b3498988945a4883253eaa3332ed4ae75919a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6976616e6d657263656465732f666c65782d6669656c64732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanmercedes/flex-fields)[![Run Laravel Pint](https://github.com/ivanmercedes/flex-fields/actions/workflows/laravel-pint.yml/badge.svg)](https://github.com/ivanmercedes/flex-fields/actions/workflows/laravel-pint.yml)

**FlexFields** brings the power of dynamic schemas to Laravel and the [Filament](https://filamentphp.com) admin panel. Think of it as **Advanced Custom Fields (ACF)** adapted to the Filament ecosystem. It allows you to create Custom Entities (like post types: "Products", "Employees", "Events") and attach customizable fields to them on the fly—without having to modify your database schema every time.

---

Features
--------

[](#features)

- **Custom Entities:** Define any data structure (like post types) without touching database migrations.
- **17+ Custom Field Types:** Support for text, textarea, number, email, URL, date, datetime, boolean/toggle, select, multiselect, color, file, image, rich text, JSON, tags, and dynamic repeaters.
- **`HasFlexFields` Eloquent Trait:** Attach dynamic flex fields directly to any existing model (`Product`, `User`, etc.).
- **`FlexFields` Facade:** Fluent global access: `FlexFields::entity('product')->records()`, `createRecord()`, `status()`, `clearCache()`.
- **Field Caching:** High-performance active field caching with automatic invalidation on save/delete.
- **Form Builder Macros:** Register custom field component handlers via `DynamicFormBuilder::macro(...)`.
- **`flex:status` Artisan Command:** Display entity, field, record, multi-tenancy, and cache configuration overview in the terminal.
- **Multi-Tenancy Support:** Full compatibility with Filament's multi-tenancy system, allowing scoped entities, fields, and records per tenant.
- **Dynamic Forms &amp; Tables:** Forms for each entity are generated automatically from its field definitions. Tables are populated dynamically with fields marked as "Show in list".
- **Drag-and-Drop Reordering:** Easily rearrange custom fields within an entity.
- **Entity Categories:** Create hierarchical categories and subcategories per entity, and categorize your records easily.
- **EAV Storage:** Robust and scalable Entity-Attribute-Value storage pattern natively adapted for Eloquent.
- **Built-in Dashboard &amp; Widget:** Visual overview of all entities, fields, and records, plus an embeddable stats widget.

---

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

[](#requirements)

- PHP 8.3 or higher
- Filament 4.x / 5.x

---

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

[](#installation)

You can install the package via composer:

```
composer require ivanmercedes/flex-fields
```

After requiring the package, run the installation command. This will publish the necessary migrations and configuration files:

```
php artisan flex-fields:install
```

Then, run the migrations:

```
php artisan migrate
```

### Register the Plugin

[](#register-the-plugin)

Add the `FlexFieldsPlugin` to your Filament panel configuration (usually inside `app/Providers/Filament/AdminPanelProvider.php`):

```
use IvanMercedes\FlexFields\FlexFieldsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            FlexFieldsPlugin::make()
                ->showDashboardPage(true)
                ->showOverviewWidget(true)
                ->showEntitiesInMenu(true), // Globally toggle entities in the sidebar
        ]);
}
```

---

How It Works
------------

[](#how-it-works)

### Entities

[](#entities)

An **Entity** represents a custom data type. For example: `Product` (slug: `product`), `Employee`, or `Event`. Each entity manages its own isolated form, with records seamlessly stored in a shared `ff_entity_records` table.

### Custom Fields

[](#custom-fields)

A **Custom Field** is attached to an Entity. It defines the type of data, a unique machine-readable key (auto-generated from the label), layout formatting (order, width), and behavior toggles (searchable, required, shown in list).

### Entity Categories

[](#entity-categories)

Entities support isolated **Categories and Subcategories**. You can build hierarchical taxonomies specific to an entity and assign them dynamically to your records.

### Entity Records

[](#entity-records)

When adding records to an entity, the form elements and structure are dynamically built via the Filament form builder using the definitions from your custom fields. All input is securely stored using the EAV pattern in `ff_field_values`.

---

Schema Builder (Code-First Entities)
------------------------------------

[](#schema-builder-code-first-entities)

FlexFields includes a Schema Builder that allows you to define your Entities and Custom Fields programmatically, similar to Laravel migrations.

```
php artisan flex:make-schema Product
php artisan flex:migrate
php artisan flex:rollback
```

For full details, read the [Schema Builder Documentation](docs/schema-builder.md).

---

Developer Experience &amp; Facade Usage
---------------------------------------

[](#developer-experience--facade-usage)

### `FlexFields` Facade

[](#flexfields-facade)

```
use IvanMercedes\FlexFields\Facades\FlexFields;

// Fluent entity access
$entity = FlexFields::entity('product');
$fields = $entity->fields(); // Cached active fields
$records = $entity->records()->where('status', 'published')->get();

// Create record with field values
$record = $entity->createRecord([
    'title' => 'Sample Product',
], [
    'price' => 99.99,
    'color' => '#00ff00',
]);
```

### `HasFlexFields` Trait

[](#hasflexfields-trait)

Attach flex fields directly to any model:

```
use Illuminate\Database\Eloquent\Model;
use IvanMercedes\FlexFields\Models\Traits\HasFlexFields;

class Product extends Model
{
    use HasFlexFields;
}

$product = Product::find(1);
$product->setFlexValue('price', 199.99);
$price = $product->getFlexValue('price');
```

### System Status Command

[](#system-status-command)

```
php artisan flex:status
```

For full details, read the [Facade &amp; Developer Experience Documentation](docs/facade_usage.md).

---

Customizing
-----------

[](#customizing)

### Manage Config Settings

[](#manage-config-settings)

To customize the default settings, publish the configuration file to your project:

```
php artisan vendor:publish --tag="flex-fields-config"
```

In `config/flex-fields.php`, you can configure Multi-Tenancy, Field Caching, Upload path patterns, and more:

```
return [
    'tenancy' => [
        'enabled' => true,
        'tenant_model' => App\Models\Team::class,
        'tenant_column' => 'tenant_id',
    ],

    'cache' => [
        'enabled' => true,
        'ttl' => 86400,
    ],

    'navigation_group' => 'Content',
];
```

---

Navigation Structure overview
-----------------------------

[](#navigation-structure-overview)

By default, the plugin registers the following navigation resources under the `FlexFields` group:

```
FlexFields (group)
├── Dashboard       → Overview of all active entities and stats
├── Entities        → Create, config, and manage entity types
├── Custom Fields   → Manage fields logically grouped per entity
└── Entity Data     → Add or edit entries/records for your entities

```

---

Database Architecture
---------------------

[](#database-architecture)

- **`ff_entities`**: Defines the "type" of the data grouping (e.g., Products, Services).
- **`ff_custom_fields`**: Serves as the "columns/attributes" logic mapped to an entity.
- **`ff_entity_categories`**: Stores hierarchical categories specifically scoped to an entity.
- **`ff_entity_records`**: A master identifier that holds one row per recorded entry.
- **`ff_entity_record_category`**: Pivot table mapping records to their assigned categories.
- **`ff_field_values`**: Holds the individual data values mapped. Effectively one row per (record × field) pair.

---

Roadmap
-------

[](#roadmap)

Curious about what's coming next? Check out the [ROADMAP.md](ROADMAP.md) for planned features and upcoming versions.

---

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance97

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94% 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 ~4 days

Total

8

Last Release

15d ago

PHP version history (2 changes)v0.1.0PHP ^8.2

v0.1.1PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53806989?v=4)[Ivan Mercedes](/maintainers/ivanmercedes)[@ivanmercedes](https://github.com/ivanmercedes)

---

Top Contributors

[![ivanmercedes](https://avatars.githubusercontent.com/u/53806989?v=4)](https://github.com/ivanmercedes "ivanmercedes (78 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

admin-panelfilamentfilamentphpformslaravelphplaravelcustom fieldsentitiesfilament

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ivanmercedes-flex-fields/health.svg)

```
[![Health](https://phpackages.com/badges/ivanmercedes-flex-fields/health.svg)](https://phpackages.com/packages/ivanmercedes-flex-fields)
```

###  Alternatives

[code16/sharp

Laravel Content Management Framework

79466.1k10](/packages/code16-sharp)[janczakb/filament-flex-fields

70 Filament v5 form components with unified design system, lazy CSS/JS, optional JSON custom fields, layout primitives, and built-in Playground — one plugin for modern Laravel admin forms.

6310.2k](/packages/janczakb-filament-flex-fields)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[eslam-reda-div/filament-copilot

A Filament plugin for AI-powered copilot features.

4113.6k](/packages/eslam-reda-div-filament-copilot)[mradder/filament-logger

Audit logging, activity tracking, exports, alerts, and dashboards for Filament admin panels.

2324.4k1](/packages/mradder-filament-logger)[mmes-design/filament-file-manager

A beautiful file manager plugin for Filament. Browse, upload, rename, move and delete files with ease.

163.8k](/packages/mmes-design-filament-file-manager)

PHPackages © 2026

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