alizharb / laravel-themer
A professional theme management system for Laravel 11/12 with first-class Livewire 4 support, strict typing, and zero-config modular integration.
Fund package maintenance!
alizharb
Installs: 154
Dependents: 2
Suggesters: 5
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/alizharb/laravel-themer
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
- illuminate/view: ^11.0|^12.0
Requires (Dev)
- alizharb/laravel-modular: ^1.1
- driftingly/rector-laravel: ^2.1
- friendsofphp/php-cs-fixer: ^3.93
- larastan/larastan: ^3.9.1
- laravel/pint: ^1.24
- livewire/livewire: ^4.0
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.12|^10.8
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5|^12.0
- rector/rector: ^2.3
- spatie/phpunit-snapshot-assertions: ^5.1
Suggests
- alizharb/filament-modular-luncher: A powerful Filament v5 manager for listing, toggling, and backing up system modules.
- alizharb/filament-themer-luncher: Provides a comprehensive Filament v5 interface for managing and switching themes.
- alizharb/laravel-hooks: Adds a universal extensibility and plugin system for Laravel applications.
- alizharb/laravel-modular: Enables theme discovery within modular structures and provides zero-config autoloading for modules.
- alizharb/laravel-modular-filament: Enables Filament v5 admin panel integration with automatic discovery in modules.
- alizharb/laravel-modular-js: Enables JavaScript discovery within modular structures and provides zero-config autoloading for modules.
- alizharb/laravel-modular-livewire: Provides automatic Livewire component discovery and registration within modules.
README
Laravel Themer is a robust, enterprise-grade theme management package for Laravel applications. It provides a seamless way to manage themes, including asset publishing, view overrides, Livewire 4 integration, and modular support. Designed for modern TALL stack applications, it simplifies the creation of multi-themed applications without the complexity.
โจ Features
- ๐๏ธ Independent Vite Builds: Per-theme
package.jsonandvite.config.jsfor total asset isolation. - ๐ฆ NPM Workspaces: Zero-config workspace integration for shared dependencies and optimized storage.
- โก Asset Shortcuts: Launch dev servers or build theme assets directly via
theme:devandtheme:build. - ๐ ๏ธ Theme Management: Create, clone, safe-delete, and activate themes with consistent
--themesupport. - ๐ Zero-IO Discovery: High-performance architecture that eliminates filesystem scans in production via deep caching.
- ๐ Rich Metadata: Support for
screenshots,tags, and management flags (removable,disableable) intheme.json. - โก Livewire 4 Integration: First-class support for Livewire components and layouts with theme-aware resolution.
- ๐จ View Overrides: Intelligent view resolution cascading from Active Theme -> Parent Theme -> Application.
- ๐ Auto-Blade Discovery: Automatic registration of theme-specific Blade components and inheritance.
- ๐ท๏ธ Theme Versioning: Support for version metadata in
theme.jsonfor easier dependency mapping. - ๐ฆ Ephemeral Switching: Temporarily switch themes for specific tasks using
Themer::forTheme(). - ๐ฃ๏ธ Route Middleware: Enforce specific themes for routes or groups via
middleware('theme:name'). - ๐งฉ Modular Support: Native integration with
laravel-modularincluding dependency verification intheme:check. - ๐ก๏ธ Hierarchy Guard: Built-in validation to detect circular dependencies, missing parents, and asset health.
- ๐ง Artisan Commands: A comprehensive suite of commands (
make,npm,dev,build,clone,delete,list,check,cache) to manage themes.
๐ Documentation
For full documentation, please visit alizharb.github.io/laravel-themer or browse the docs/ directory.
๐ฆ Installation
Install the package via Composer:
composer require alizharb/laravel-themer
Quick Start (Recommended)
Run the installation command to automatically set up Laravel Themer:
php artisan themer:install
This interactive command will:
- โ
Publish the configuration file (
config/themer.php) - โ
Create the themes directory (default:
themes/) - โ
Optionally configure
vite.config.jswith thethemerLoaderfor automatic theme asset bundling
Manual Configuration
If you prefer manual setup or need more control, see the Installation Guide for detailed instructions on:
- Publishing configuration files
- Setting up Vite integration
- Configuring theme paths and discovery rules
๐ Related Packages
Laravel Themer is part of a comprehensive modular ecosystem for Laravel applications:
| Package | Description |
|---|---|
| laravel-modular | Framework-agnostic modular architecture with zero-config autoloading and 29+ Artisan command overrides. Required for modular theme discovery. |
| laravel-modular-livewire | Official Livewire 4 bridge providing automatic component discovery and registration within modules. |
| laravel-modular-filament | Official Filament v5 bridge enabling admin panel integration with automatic resource discovery in modules. |
| laravel-hooks | Universal extensibility and plugin system for Laravel 12+ applications with WordPress-style hooks and filters. |
| filament-themer-luncher | A comprehensive Filament v5 interface for managing, switching, and backing up themes. |
| filament-modular-luncher | A powerful Filament v5 manager for listing, toggling, and managing system modules. |
These packages work seamlessly together to provide a complete modular development experience.
๐ Usage
Creating a Theme
Generate a new theme with a standard directory structure:
php artisan theme:make "Dark Theme"
Managing Dependencies
Install packages into a theme workspace directly from the root:
php artisan theme:npm --theme=dark-theme install lodash
Developing Assets
Launch a dedicated Vite dev server for your theme:
php artisan theme:dev --theme=dark-theme
Cloning & Deletion
Safe and fast lifecycle management:
# Duplicate an existing theme php artisan theme:clone "Summer Edition" --theme=dark-theme # Safe removal (respects 'removable' flag) php artisan theme:delete --theme=summer-edition
Activating a Theme
Switch the active theme globally:
php artisan theme:activate dark-theme
Livewire Integration
The package automatically registers Livewire components within your theme.
php artisan make:livewire Header --theme=dark-theme
๐งช Testing
We strictly enforce testing. Use the provided test suite to verify your themes:
vendor/bin/pest
๐ Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel Themer development. If you are interested in becoming a sponsor, please visit the Laravel Themer GitHub Sponsors page.
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING for details.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ Acknowledgments
- Laravel: For creating the most elegant PHP framework.
- Spatie: For setting the standard on Laravel package development.
๐ Security
If you discover any security-related issues, please email Ali Harb at harbzali@gmail.com.
๐ License
The MIT License (MIT). Please see License File for more information.
Made with โค๏ธ by Ali Harb
