softok2 / filament-page-builder
This is my package filament-page-builder
Fund package maintenance!
softok2
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
README
# Filament tool for improve management of pages content speed and easy
This package comes with predefined form components that can be used to build a page:
- Text
- ImageUpload
- TextBox
- Marquee
- Slider
Installation
You can install the package via composer:
composer require softok2/filament-page-builder
You can set up all the necessary files by running the following command:
php artisan filament-page-builder:install
And it is ready to use!!
Usage
Its recommended to run migrations and seeders to get the default components and pages.
php artisan migrate --seed
The packages come with a predefined page blocks and layout components in App//Filament//PageBuilder
.
Page blocks look like this:
class HomeBlock extends PageBlock { const HEADER_SECTION = 'header_section'; public static string $fileUploadDirectory = 'uploads/pages/'; public function headerSection(): Block { return Block::make(self::HEADER_SECTION)->label(__('Header Section')) ->schema([ Text::make('title'), ImageUpload::make('background'), ])->maxItems(1); } }
Define your own section per page declaring a method with the name and de Section
suffix.
Include the plugins in your admin panel:
... ->plugins([ FilamentPageBuilder::make() ])
Customization
Yoy can define your own blocks and components by creating both classes and mapping them in the plugin configuration.
For create a new block you can run the following command:
php artisan filament-page-builder-block:make HistoryBlock
For create a new layout component you can run the following command:
php artisan filament-page-builder-lc:make HeroComponent
Then you can map the new blocks and components in the plugin configuration:
FilamentPageBuilder::make() ->withPosts() ->blocksMapper([ 'history' => HistoryBlock::class, ]) ->layoutsComponentsMapper([ 'hero' => HeroComponent::class, ])
In the example above, 'history' and 'hero' are the name of the page and component respectively. You can easly add them in the seeders:
- PageSeeder.php
- LayoutComponentSeeder.php
Testing
composer test
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.