novius/laravel-filament-page-manager
Composer 安装命令:
composer require novius/laravel-filament-page-manager
包简介
A Laravel Filament package to manage pages.
README 文档
README
Laravel Filament Page Manager
Introduction
This package allows you to manage pages with custom templates.
Requirements
- PHP >= 8.2
- Laravel >= 11.0
- Laravel Filament >= 4
Installation
composer require novius/laravel-filament-page-manager
Run migrations with:
php artisan migrate
In your AdminFilamentPanelProvider add the PageManagerPlugin :
use Novius\LaravelFilamentPageManager\Filament\PageManagerPlugin; class AdminFilamentPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ PageManagerPlugin::make(), ]) // ... ; } }
Route
Add to your routes/web.php file:
\Novius\LaravelFilamentPageManager\Facades\PageManager::routes();
Configuration
Some options that you can override are available.
php artisan vendor:publish --provider="Novius\LaravelFilamentPageManager\LaravelFilamentPageManagerServiceProvider" --tag="config"
If you're overload the Page model (and so the filament resource), remember to change them in the config.
Templates
To add a template, add your custom class to templates array in the configuration file or place it under App\Pages\Templates namespace if you keep this value for autoload_templates_in.
Your class must implement Novius\LaravelFilamentPageManager\Contracts\PageTemplate.
Example :
In app/Pages/Templates/StandardTemplate.php
<?php namespace App\Pages\Templates; use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\RichEditor; use Novius\LaravelFilamentPageManager\Contracts\PageTemplate; class StandardTemplate implements PageTemplate { public function key(): string { return 'standard'; } public function name(): string { return trans('laravel-filament-page-manager::template.standard_template'); } public function fields(): array { return [ RichEditor::make('extras.content') // Prefix the name by `extras.` to save it in the extras fields ->label('Content'), DatePicker::make('extra.date') ->label('Date'), ]; } public function casts() : array { return [ 'date' => 'date', ]; } public function view(): string { return 'templates/standard'; } public function viewParameters(Request $request, Page $page): array { $settings = \App\Model\SettingsModel::instance(); return [ 'page' => $page, 'settings' => $settings, ]; } }
You could also overload the DefaultTemplate class
<?php namespace App\Pages\Templates; use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\RichEditor; use Novius\LaravelFilamentPageManager\Templates\DefaultTemplate; class StandardTemplate extends DefaultTemplate { public function fields(): array { return [ ...parent::fields(), DatePicker::make('extras.date') ->label('Date'), ]; } public function casts() : array { return [ 'date' => 'date', ]; } public function view(): string { return 'templates/standard'; } }
Fields
To use the specific template fields :
$page = \Novius\LaravelFilamentPageManager\Models\Page::where('template', 'standard')->first(); $content = $page->extras['content']; // Date will be a Carbon instance, thanks to the cast $date = $page->extras['date'];
View
In the template view, use the documentation of laravel-meta to implement meta tags.
The page manager automatically calls the CurrentModel::setModel() method for you, with the current page displayed.
Special Pages
The page manager came with three special pages:
- Home page
- Page for 404 error
You could remove those special pages if you don't need them.
For the 404 pages to work, you must add middleware HandleSpecialPages to the Middleware group Web. In your provider/app.php file :
use Illuminate\Routing\Middleware\SubstituteBindings; use Novius\LaravelFilamentPageManager\Http\Middleware\HandleSpecialPages; return Application::configure(basePath: dirname(__DIR__)) //... ->withMiddleware(function (Middleware $middleware) { //... $middleware->web(remove: [ SubstituteBindings::class, ]); $middleware->web(append: [ HandleSpecialPages::class, SubstituteBindings::class, ]); //... }) //... })->create();
Custom Special page
You can create your owned special page. Add your custom class to special array in the configuration file or place it under App\Pages\Special namespace if you keep this value for autoload_special_in.
Here are two examples.
One for a contact page:
<?php namespace App\Pages\Special; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; use Novius\LaravelFilamentPageManager\Contracts\PageTemplate; use Novius\LaravelFilamentPageManager\Contracts\Special; use Novius\LaravelFilamentPageManager\Facades\PageManager; class Contact implements Special { public function key(): string { return 'contact'; } public function name(): string { return 'Contact'; } public function icon(): ?string { // you can return null if you d'ont want icon in the filament interface return 'heroicon-o-paper-airplane'; } public function pageSlug(): ?string { // return null, let the user define is owned slug for this page return null; } public function template(): ?PageTemplate { // return null, let the user define is owned template for this page return null; } public function statusCode(): ?int { // return null, your page has a 200 status code return null; } public function routes(): void { // do nothing, your page will be handled by the main page manager route } }
Another for a page displaying a product :
<?php namespace App\Pages\Special; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; use Novius\LaravelFilamentPageManager\Contracts\Special; use Novius\LaravelFilamentPageManager\Facades\PageManager; class Product implements Special { public function key(): string { return 'product'; } public function name(): string { return 'Product'; } public function icon(): ?string { return null; } public function pageSlug(): ?string { // return null, let the user define is owned slug for this page return null; } public function template(): ?PageTemplate { return \App\Pages\Templates\ProductTemplate::class; } public function statusCode(): ?int { // return null, your page has a 200 status code return null; } public function routes(): void { $this->addRouteGet( '{product}', static function (Request $request, Product $product) { return PageManager::render($request); }, 'page-manager.product' ); } }
Next in the method viewParameters of your template, you could do that:
use Novius\LaravelFilamentPageManager\Contracts\PageTemplate; class ProductTemplate implements PageTemplate { // ... public function viewParameters(Request $request, Page $page): array { $product = Route::getCurrentRoute()?->parameter('product'); CurrentModel::setModel($product); return [ 'page' => $page, 'product' => $product, ]; } }
Guards
Si vous voulez protéger certaines pages derrière des guards, il suffit d'ajouter dans la config laravel-filament-page-manager.php:
// If you want certain pages to be protected by a Guard, indicate the list of guards you want to make available (must be in `config('auth.guards')` keys) 'guards' => [ 'myquard', ],
Facade and Helpers
use Novius\LaravelFilamentPageManager\Facades\PageManager; use Novius\LaravelFilamentPageManager\Models\Page; use Novius\LaravelFilamentPageManager\SpecialPages\Page404; PageManager::templates(); // return Collection<string, PageTemplate> PageManager::template('default'); // return the PageTemplate with the 'default' key PageManager::specialPages(); // return Collection<string, Special> PageManager::special('homepage'); // return the Special with the 'homepage' key PageManager::routes(); // Use it in your `routes/web.php` file Page::getHomePage('en'); // return the Page defined as special Homepage in locale 'en' Page::getHomePage(); // return the Page defined as special Homepage in the current locale Page::getSpecialPage('404', 'en'); // return the Page defined as special Page404 in locale 'en' Page::getSpecialPage('404'); // return the Page defined as special Page404 in the current locale Page::getSpecialPage(Page404::class); // return the Page defined as special Page404 in the current locale Page::getSpecialPage(new Page404()); // return the Page defined as special Page404 in the current locale
Seeder
You can use the \Novius\LaravelFilamentPageManager\Database\Seeders\PageSeeder to create menus.
Create a new seeder, extend the class and define the pages() method. You can also override the postCreate() method to add custom logic.
namespace Database\Seeders; use Novius\LaravelFilamentPageManager\SpecialPages\Homepage; use Novius\LaravelFilamentPageManager\Templates\DefaultTemplate; class PageSeeder extends \Novius\LaravelFilamentPageManager\Database\Seeders\PageSeeder { protected function pages(): array { return [ [ 'title' => 'Home', 'slug' => '/', 'special' => Homepage::class, 'template' => DefaultTemplate::class, ], ]; } protected function postCreate(array $config, LocaleData $locale, Menu $menu): void { // Add custom logic here } }
Lint
Run php-cs with:
composer run-script lint
Contributing
Contributions are welcome!
Leave an issue on GitHub, or create a Pull Request.
Licence
This package is under GNU Affero General Public License v3 or (at your option) any later version.
novius/laravel-filament-page-manager 适用场景与选型建议
novius/laravel-filament-page-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 392 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「filament」 「page-manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 novius/laravel-filament-page-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 novius/laravel-filament-page-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 novius/laravel-filament-page-manager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova package to manage pages.
Alfabank REST API integration
Database-driven onboarding for Filament: progress checklists and guided spotlight tours, translatable to any locale.
Laravel package for Accurate Online API integration.
A comprehensive page management system for Filament v4 with templates, regions, SEO, and multilingual support
Create-project starter for a Laravel application with the public Capell CMS foundation.
统计信息
- 总下载量: 392
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2026-02-18