alizharb/filament-themes-manager
Filament-powered admin panel for managing themes in Laravel apps via qirolab/laravel-themer. Install themes from ZIP, GitHub, or local folders, clone and customize, preview safely, activate with one click, validate structure, and protect critical themes.
A comprehensive, enterprise-grade theme management system for Laravel Filament applications.
Built to seamlessly integrate with qirolab/laravel-themer, this package provides a sophisticated admin interface for managing, installing, previewing, and switching themes with professional-grade security and performance optimization.
| Component | Version |
|---|---|
| PHP | ^8.2|^8.3|^8.4 |
| Laravel | ^11.0|^12.0 |
| Filament | ^4.0 |
| Laravel Themer | ^2.0 |
composer require alizharb/filament-themes-manager
php artisan vendor:publish --tag=filament-themes-manager-config
Add to your Filament panel in app/Providers/Filament/AdminPanelProvider.php:
use Alizharb\FilamentThemesManager\FilamentThemesManagerPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentThemesManagerPlugin::make(),
]);
}
Add middleware to bootstrap/app.php:
->withMiddleware(function (Middleware $middleware) {
$middleware->web(append: [
\Alizharb\FilamentThemesManager\Http\Middleware\ThemePreviewMiddleware::class,
]);
})
Access the theme management interface at System โ Theme Manager in your Filament admin panel.
| Action | Description | Access |
|---|---|---|
| View Details | Inspect theme configuration and metadata | Eye icon |
| Activate Theme | Switch active theme instantly | Status toggle |
| Preview Theme | Test theme safely in session | Preview button |
| Clone Theme | Duplicate theme for customization | Clone action |
| Delete Theme | Remove unused themes safely | Delete button |
php artisan theme:install username/repository --type=github --activate
php artisan theme:install /path/to/theme.zip --type=zip
php artisan theme:clone default "Custom Default" --slug=custom-default --activate
themes/my-theme/
โโโ theme.json # Theme manifest (required)
โโโ views/ # Blade templates
โ โโโ components/ # Reusable components
โ โโโ layouts/ # Page layouts
โโโ css/
โ โโโ app.css # Stylesheets
โโโ js/
โ โโโ app.js # JavaScript assets
โโโ vite.config.js # Build configuration
โโโ screenshot.png # Preview image
{
"name": "Professional Theme",
"slug": "professional-theme",
"version": "1.0.0",
"description": "A professional theme for Laravel applications",
"author": "Your Name",
"author_email": "contact@example.com",
"homepage": "https://example.com",
"screenshot": "screenshot.png",
"parent": null,
"requirements": {
"php": ">=8.3",
"laravel": ">=12.0"
},
"assets": ["css/app.css", "js/app.js"],
"supports": ["responsive", "dark-mode"],
"license": "MIT"
}
'discovery' => [
'paths' => [
'themes' => base_path('themes'),
'resources' => resource_path('themes'),
],
'cache_duration' => 3600,
'auto_discover' => true,
],
'security' => [
'validate_theme_structure' => true,
'scan_malicious_code' => true,
'protected_themes' => ['default'],
'allowed_file_types' => [
'php', 'blade.php', 'css', 'scss', 'js', 'vue', 'json'
],
],
'preview' => [
'enabled' => true,
'route_prefix' => 'theme-preview',
'session_duration' => 3600,
'cache_screenshots' => true,
],
'widgets' => [
'enabled' => true,
'page' => true, // Theme Manager page
'dashboard' => true, // Main dashboard
],
Ctrl+H to toggle banner visibility| Route | Purpose |
|---|---|
/theme-preview/{slug} |
Activate preview |
/theme-preview/exit |
Exit preview mode |
/theme-preview/{slug}/activate |
Make preview permanent |
use Alizharb\FilamentThemesManager\Services\ThemeManagerService;
$service = app(ThemeManagerService::class);
// Theme operations
$themes = $service->getAllThemes();
$service->setActiveTheme('theme-slug');
$service->installThemeFromGitHub('username/repository');
$service->cloneTheme('source-slug', 'new-slug', 'New Theme Name');
// Analytics
$stats = $service->getThemeStats();
use Alizharb\FilamentThemesManager\Models\Theme;
// Queries
$themes = Theme::all();
$activeThemes = Theme::active()->get();
$validThemes = Theme::valid()->get();
$theme = Theme::bySlug('theme-slug')->first();
// Statistics
$totalCount = Theme::count();
$activeCount = Theme::getActiveCount();
$validCount = Theme::getValidCount();
theme.json files contain valid JSONphp artisan cache:cleartheme.json are accuratenpm run build for production assets'debug' => env('THEME_DEBUG', false),
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)composer test # Run test suite
vendor/bin/pest # Run Pest tests directly
vendor/bin/pest --coverage # Generate coverage report
vendor/bin/phpstan analyse # Static analysis
vendor/bin/pint # Fix code style
vendor/bin/rector process # Code modernization
This package is open-sourced software licensed under the MIT License. See LICENSE.md for details.
Your support helps maintain and improve this package:
Built with โค๏ธ by Ali Harb
Making Laravel theming professional and accessible
How can I help you explore Laravel packages today?