PHPackages                             iamgerwin/filament-flexible-content - 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. iamgerwin/filament-flexible-content

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

iamgerwin/filament-flexible-content
===================================

Flexible Content &amp; Repeater Fields for Laravel Filament v4

1.2.3(7mo ago)155[6 PRs](https://github.com/iamgerwin/filament-flexible-content/pulls)MITPHPPHP ^8.2CI passing

Since Sep 22Pushed 1mo agoCompare

[ Source](https://github.com/iamgerwin/filament-flexible-content)[ Packagist](https://packagist.org/packages/iamgerwin/filament-flexible-content)[ Docs](https://github.com/iamgerwin/filament-flexible-content)[ GitHub Sponsors](https://github.com/:vendor_name)[ RSS](/packages/iamgerwin-filament-flexible-content/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (12)Used By (0)

Filament Flexible Content
=========================

[](#filament-flexible-content)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fe5724b065e4e8e5d10b98979e2242236a3ae64afdfe343839b90e578d615218/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69616d67657277696e2f66696c616d656e742d666c657869626c652d636f6e74656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iamgerwin/filament-flexible-content)[![Total Downloads](https://camo.githubusercontent.com/cf45f610824e6f95552fa82ffe56a27cf896cd2be3cd3073ce5aa93b3f23e7b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69616d67657277696e2f66696c616d656e742d666c657869626c652d636f6e74656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iamgerwin/filament-flexible-content)[![PHP Version](https://camo.githubusercontent.com/13c0e1512241a04c134506b18d0e323e913f0f465104b88eb726eda6a1b73fe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f69616d67657277696e2f66696c616d656e742d666c657869626c652d636f6e74656e743f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/13c0e1512241a04c134506b18d0e323e913f0f465104b88eb726eda6a1b73fe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f69616d67657277696e2f66696c616d656e742d666c657869626c652d636f6e74656e743f7374796c653d666c61742d737175617265)[![Filament Version](https://camo.githubusercontent.com/333dcebaed56b4e82d7286135e6907c856f039ba26f62e3d57b0f7f2ed5ee797/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d76332e3225323025374325323076342e302d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/333dcebaed56b4e82d7286135e6907c856f039ba26f62e3d57b0f7f2ed5ee797/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d76332e3225323025374325323076342e302d626c75653f7374796c653d666c61742d737175617265)

Flexible Content &amp; Repeater Fields for Laravel Filament v4. Built with PHP 8.2+ features for maximum performance and type safety.

Features
--------

[](#features)

- 🎨 **Flexible Layout System** - Create custom content layouts with ease
- 🔧 **Built for Filament v3 &amp; v4** - Seamlessly integrates with Filament's form builder
- 🚀 **PHP 8.2+ Optimized** - Leverages modern PHP features for performance
- 📦 **Preset Support** - Bundle layouts into reusable presets
- 🎯 **Type-Safe** - Full type declarations and strict typing throughout
- 🧩 **Extensible** - Easy to extend with custom layouts and functionality
- 💾 **Cast Support** - Eloquent cast for seamless database integration
- 🛠️ **Artisan Commands** - Quickly scaffold new layouts
- 🧪 **Fully Tested** - Comprehensive test suite using Pest

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

[](#requirements)

- PHP ^8.2
- Laravel ^10.0, ^11.0, or ^12.0
- Filament ^3.2 or ^4.0

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

[](#installation)

You can install the package via composer:

```
composer require iamgerwin/filament-flexible-content
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="filament-flexible-content-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="filament-flexible-content-config"
```

This is the contents of the published config file:

```
return [
    'layouts_directory' => app_path('Filament/Flexible/Layouts'),
    'presets_directory' => app_path('Filament/Flexible/Presets'),
    'auto_register_layouts' => true,
    'auto_register_presets' => true,
    'cache' => [
        'enabled' => env('FLEXIBLE_CONTENT_CACHE', true),
        'key' => 'filament-flexible-content',
        'ttl' => 3600,
    ],
    'defaults' => [
        'collapsible' => true,
        'cloneable' => true,
        'reorderable' => true,
        'columns' => 2,
    ],
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Add the flexible content field to your Filament resource:

```
use IamGerwin\FilamentFlexibleContent\Forms\Components\FlexibleContent;
use App\Filament\Flexible\Layouts\HeroLayout;
use App\Filament\Flexible\Layouts\ContentLayout;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            FlexibleContent::make('content')
                ->layouts([
                    HeroLayout::make(),
                    ContentLayout::make(),
                ])
        ]);
}
```

### Creating Layouts

[](#creating-layouts)

Create a new layout using the artisan command:

```
php artisan make:flexible-layout HeroSection
```

Or create a layout manually:

```
