alizharb/laravel-themer
Enterprise-grade theme management for Laravel. Create, clone, activate, and safely delete themes with per-theme Vite builds, NPM workspaces, asset shortcuts, view overrides, and Livewire 4 support. Includes metadata, wizards, and fast production caching.
The configuration file is located at config/themer.php after running php artisan themer:install.
'themes_path' => base_path('themes'),
The root directory where themes are stored. Laravel Themer will scan this directory for theme.json files.
'active' => (string) env('THEME', 'default'),
The currently active theme. This is typically set via the THEME environment variable in .env.
Example:
THEME=mytheme
'assets' => [
'path' => 'themes',
'publish_on_activate' => true,
'symlink' => (bool) env('THEMER_SYMLINK', true),
],
pathThe public directory suffix where theme assets will be published (e.g., public/themes).
publish_on_activateWhether to automatically publish assets when a theme is activated. Set to false if you prefer manual asset publishing.
symlinkWhether to use symlinks instead of copying files. Symlinks are faster and save disk space, but require proper server permissions.
Production Tip: Set THEMER_SYMLINK=false in production if your deployment process doesn't support symlinks.
'discovery' => [
'filename' => 'theme.json',
'scan_modules' => true,
],
filenameThe metadata filename to look for when scanning for themes.
scan_modulesWhether to scan Laravel Modular modules for themes. Requires alizharb/laravel-modular.
'auto_namespaces' => [
'layouts' => 'resources/views/layouts',
'pages' => 'resources/views/livewire/pages',
],
Automatically register view and Livewire namespaces for common theme directories. These work alongside Livewire 4's native component_namespaces configuration.
Usage:
{{-- Resolves to active theme's layouts directory --}}
<x-layouts::app>
{{-- Content --}}
</x-layouts::app>
{{-- Resolves to active theme's pages directory --}}
<livewire:pages::home />
Customization: Add your own auto-namespaces:
'auto_namespaces' => [
'layouts' => 'resources/views/layouts',
'pages' => 'resources/views/livewire/pages',
'components' => 'resources/views/components',
'partials' => 'resources/views/partials',
],
| Variable | Default | Description |
|---|---|---|
THEME |
default |
Active theme slug |
THEMER_SYMLINK |
true |
Use symlinks for assets |
If you want to store themes in a different location:
'themes_path' => storage_path('themes'),
For scanning multiple directories (requires custom implementation):
// In a service provider
$manager = app('themer');
$manager->scan(base_path('themes'));
$manager->scan(base_path('vendor-themes'));
For manual control over asset publishing:
'assets' => [
'publish_on_activate' => false,
],
Then manually publish when needed:
php artisan theme:publish mytheme
How can I help you explore Laravel packages today?