tomatophp/filament-cms
Filament CMS plugin for Laravel that adds ready-made content management tools to your Filament admin panel. Manage pages, menus, blocks, and more with a clean UI, configurable features, and extensible resources for building lightweight CMS sites fast.
Installation Begin by installing via Composer:
composer require tomatophp/filament-cms
Publish the package assets and config:
php artisan vendor:publish --provider="TomatoPHP\FilamentCMS\FilamentCMSServiceProvider" --tag="filament-cms-config"
php artisan vendor:publish --provider="TomatoPHP\FilamentCMS\FilamentCMSServiceProvider" --tag="filament-cms-assets"
Register the CMS
Add the CMS panel to your Filament admin in app/Providers/Filament/AdminPanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->plugins([
\TomatoPHP\FilamentCMS\FilamentCMSPlugin::make(),
]);
}
First Use Case: Create a Page
home).Page Management
home, blog-post) in resources/views/vendor/filament-cms/templates/.@cms) to inject CMS content into existing views:
@cms('home', 'hero_section')
Theme Management
php artisan vendor:publish --provider="TomatoPHP\FilamentCMS\FilamentCMSServiceProvider" --tag="filament-cms-views"
resources/views/vendor/filament-cms/ (e.g., partials/head.blade.php).filament-cms.config.js file (published to public/filament-cms/).Content Blocks
FilamentCMS::registerBlockType(
TestimonialBlock::make()
->schema([
TextInput::make('quote')->required(),
TextInput::make('author'),
])
);
Media Handling
filament/spatie-media-library) for image uploads.SEO & Metadata
getMetaTags() method in custom templates to dynamically fetch metadata.public static function getPages(): array
{
return FilamentCMS::getPages()->where('status', 'published')->get();
}
Route::get('/{page}', [CMSController::class, 'show'])->name('cms.page');
Caching Issues
php artisan filament:cache:clear
php artisan cache:clear
filament-cms.php ('cache_enabled' => false) during development.Template Overrides
@extends('filament-cms::layouts.app')) to avoid missing layouts.Block Schema Conflicts
handle() values).custom_testimonial_block.Media Permissions
FilamentCMS::configureMediaLibrary(function (MediaLibraryManager $manager) {
$manager->allowedFileTypes(['jpg', 'png', 'pdf']);
});
Frontend Asset Loading
filament-cms.config.js file for global scripts:
window.FilamentCMSConfig = {
scripts: [
'/custom-script.js',
],
styles: [
'/custom-style.css',
],
};
Log CMS Events
Enable logging for CMS events in filament-cms.php:
'logging' => [
'enabled' => true,
'channel' => 'single',
],
Check logs at storage/logs/filament-cms.log.
Template Debugging
Use Blade’s @debug directive to inspect variables:
@cms('home', 'content')
@debug(get_defined_vars())
Database Quirks
php artisan migrate if the filament_cms_pages table is missing.php artisan filament-cms:reset to wipe test pages/blocks.Custom Page Models
Extend the default Page model:
class CustomPage extends \TomatoPHP\FilamentCMS\Models\Page
{
protected $casts = [
'is_featured' => 'boolean',
];
}
Register it in FilamentCMSServiceProvider:
FilamentCMS::usePageModel(CustomPage::class);
Hooks & Events
Listen to CMS events (e.g., PageSaved):
FilamentCMS::listen('page.saved', function ($page) {
// Send analytics or update search index
});
API Endpoints Expose CMS data via Laravel API routes:
Route::get('/api/cms/pages', [CMSController::class, 'apiIndex']);
Headless Mode Disable the Filament admin UI and use the CMS as a headless backend:
FilamentCMS::headless(true);
How can I help you explore Laravel packages today?