threls / filament-page-builder
A flexible page builder plugin for Filament with multiple content blocks
Fund package maintenance!
Threls
Installs: 529
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
pkg:composer/threls/filament-page-builder
Requires
- php: ^8.2|^8.4
- cactus-galaxy/filament-astrotomic: ^0.4.0
- filament/filament: ^3.2
- illuminate/contracts: ^10.0|^11.0|^12.0
- league/flysystem-aws-s3-v3: ^3.0
- spatie/laravel-data: ^4.0
- spatie/laravel-medialibrary: ^11.0
- spatie/laravel-package-tools: ^1.15.0
- spatie/laravel-query-builder: ^6.3
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9|^8.0
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
- dev-main
- v3.1.2-beta
- v3.1.1-beta
- v3.1.0-beta
- v3.0.9-beta
- v3.0.8-beta
- v3.0.7-beta
- v3.0.6-beta
- v3.0.5-beta
- v3.0.4-beta
- v3.0.3-beta
- v3.0.2-beta
- 3.0.1-beta
- 3.0.0-beta
- 2.4.1-beta
- 2.4.0-beta
- 2.3.9-beta
- 2.3.8-beta
- 2.3.7-beta
- 2.3.6-beta
- 2.3.5-beta
- 2.3.4-beta
- 2.3.3-beta
- 2.3.2-beta
- 2.3.1-beta
- 2.3.0-beta
- 2.2.9-beta
- 2.2.8-beta
- 2.2.7-beta
- 2.2.6-beta
- 2.2.5-beta
- 2.2.4-beta
- 2.2.3-beta
- v2.2.2-beta
- 2.2.1-beta
- 2.2.0-beta
- 2.1.9-beta
- 2.1.8-beta
- 2.1.7-beta
- 2.1.6-beta
- 2.1.5-beta
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.0.0
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-7
- dev-fix-slugs-and-path
- dev-fix-slugs-for-internal-pages
- dev-fix-menu-item-being-cut-off
- dev-KSU-484-old-blueprint-disappearing
- dev-setup-playground
- dev-example-setup
- dev-change-multilang-library
- dev-fix-translation-on-pagebuilder
- dev-big-fix-select-enum
- dev-TB-55
- dev-CSG-96-Handle-multilingual-in-the-page-builder
This package is auto-updated.
Last update: 2025-10-13 20:34:51 UTC
README
A flexible page builder plugin for Filament v3 with multiple content blocks, perfect for creating dynamic pages in your Laravel applications.
Features
- Multiple Content Blocks: Hero sections, image galleries, banners, rich text, and more
- File Management: Integrated file uploads with configurable storage disks
- Status Management: Draft, Published, and Archived page states
- Multi-language Support: Built-in language switching capability
Installation
You can install the package via composer:
composer require threls/filament-page-builder
You can publish and run the migrations with:
php artisan vendor:publish --tag="filament-page-builder-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="filament-page-builder-config"
Usage
Basic Setup
- Install the plugin in your Filament panel:
use Threls\FilamentPageBuilder\PageBuilderPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ PageBuilderPlugin::make(), ]); }
Available Content Blocks
The page builder comes with the following content blocks out of the box:
- Hero Section: Large banner with title, subtitle, image, and call-to-action button
- Image Gallery: Collection of images with optional text and button
- Image Cards: Repeatable cards with image, text, and button
- Horizontal Ticker: Rotating content sections with images and descriptions
- Banner: Simple banner with title, text, image, and button
- Rich Text: WYSIWYG text editor content
- Key-Value Section: FAQ-style content with title/description pairs
- Map Location: Geographic location with coordinates and address
- Relationship Content: Display related models (testimonials, FAQs, events)
Configuration
The package publishes a configuration file where you can customize:
return [ // Default storage disk for uploads 'disk' => env('FILAMENT_PAGE_BUILDER_DISK', 'public'), // Navigation settings 'navigation_group' => 'Content', 'navigation_icon' => 'heroicon-o-rectangle-stack', // API settings 'api' => [ 'enabled' => env('FILAMENT_PAGE_BUILDER_API_ENABLED', true), 'prefix' => env('FILAMENT_PAGE_BUILDER_API_PREFIX', 'api'), 'middleware' => ['api'], ], ];
Working with Pages
Creating Pages
Pages can be created through the Filament admin interface. Each page has:
- Title (automatically generates slug)
- Status (Draft, Published, Archived)
- Content blocks (built using the visual builder)
Retrieving Page Data
You can retrieve and work with page data using the included Data Transfer Objects:
use Threls\FilamentPageBuilder\Models\Page; use Threls\FilamentPageBuilder\Data\PageData; $page = Page::where('slug', 'home')->first(); $pageData = PageData::fromModel($page); // Access structured content foreach ($pageData->content as $block) { echo $block->type; // e.g., 'hero-section' // $block->data contains the structured block data }
Using the API
The package includes a built-in API for retrieving page data:
// Available endpoints: // GET /api/pages - Returns all published pages // You can filter by slug using query parameters: /api/pages?filter[slug]=home // Example controller usage in your app: Route::get('pages', function() { return Http::get('https://yourdomain.com/api/pages')->json(); }); Route::get('pages/{slug}', function($slug) { return Http::get("https://yourdomain.com/api/pages?filter[slug]={$slug}")->json(); });
You can configure the API in the config file:
// In your config/filament-page-builder.php 'api' => [ 'enabled' => env('FILAMENT_PAGE_BUILDER_API_ENABLED', true), 'prefix' => env('FILAMENT_PAGE_BUILDER_API_PREFIX', 'api'), 'middleware' => ['api'], ], // Language Switch Settings 'language_switch' => [ 'enabled' => true, 'locales' => [ 'en' => 'EN', // Add more languages as needed ], 'default_locale' => 'en', ],
Requirements
- PHP 8.2 or higher (including PHP 8.4)
- Laravel 10.0 or higher
- Filament 3.2 or higher
- Spatie Laravel Query Builder 6.3 or higher (for API functionality)
Playground (In-Repo Example App)
A full Laravel app is available at ./playground for live development and testing via a Composer path repository. Changes to the plugin code are reflected immediately in the playground.
Quick Start
-
Requirements
- MySQL running locally
- Update
playground/.envDB credentials if needed (defaults: DB_DATABASE=filament_playground, DB_USERNAME=root, DB_PASSWORD=)
-
Setup
- Run the setup script:
./bin/setup-playground
This will install dependencies, publish the plugin config and migrations, run migrations, and seed demo data (including an admin user).
- Run the setup script:
-
Use
- Start the app from the
playgrounddirectory:php artisan serve
- Admin Panel: http://localhost:8000/admin
- Login: admin@example.com
- Password: password
- API Endpoint: http://localhost:8000/api/pages
- Start the app from the
Developer Workflow
- The playground consumes this plugin via a Composer path repository (
"url": "../"), so code edits insrc/are reflected without re-install. - If you change service providers, config, or migrations, re-run the setup steps as needed:
php artisan vendor:publish --provider="Threls\\FilamentPageBuilder\\PageBuilderServiceProvider" --tag="filament-page-builder-config" --force php artisan vendor:publish --provider="Threls\\FilamentPageBuilder\\PageBuilderServiceProvider" --tag="filament-page-builder-migrations" --force php artisan migrate --force php artisan db:seed --force
- To reset demo data during development, you can truncate the pages tables or create additional seeders tailored to your needs.
Troubleshooting
- If the panel isn’t accessible, ensure the provider is registered in
playground/bootstrap/providers.php:return [ App\Providers\AppServiceProvider::class, App\Providers\Filament\AdminPanelProvider::class, ];
- If publishing fails, confirm the plugin service provider class name and tags match your local code.
- Ensure MySQL credentials in
playground/.envare correct and the database exists.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.