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.
Laravel Themer provides a comprehensive suite of Artisan commands for theme management.
theme:makeCreate a new theme with complete directory structure.
php artisan theme:make {name} [options]
Arguments:
name - The name of the theme (e.g., "MyTheme")Options:
--parent= - Optional parent theme for inheritance--description= - Theme description--author= - Theme author name--tags= - Comma-separated tags--provider - Generate a namespaced ThemeServiceProviderExamples:
# Basic theme
php artisan theme:make Portfolio
# Theme with metadata
php artisan theme:make Portfolio \
--description="Professional portfolio theme" \
--author="John Doe" \
--tags="portfolio,modern,responsive"
# Theme with parent and provider
php artisan theme:make PortfolioDark \
--parent=portfolio \
--provider
theme:activateActivate a theme and update the .env file.
php artisan theme:activate {theme?} [options]
Arguments:
theme - Theme name or slug (optional, will prompt if not provided)Options:
--no-interaction - Skip confirmation promptsExamples:
# Direct activation
php artisan theme:activate portfolio
Before activating a theme globally, you can preview it securely by appending the ?preview_theme=slug parameter to any URL in your application. This is handled by the PreviewTheme middleware:
APP_ENV=local): Appending ?preview_theme=my-theme works instantly.themer.preview.enabled is explicitly set to true in your configuration.theme:listList all discovered themes with their metadata.
php artisan theme:list
Output includes:
theme:infoDisplay detailed diagnostic information about a specific theme.
php artisan theme:info {theme?}
Arguments:
theme - Theme name or slug (optional, uses active theme if not provided)Displays:
[@theme_asset](https://github.com/theme_asset)Generate a public URL for a theme asset.
<link rel="stylesheet" href="[@theme_asset](https://github.com/theme_asset)('css/app.css')">
[@theme_vite](https://github.com/theme_vite)Load theme-specific assets using Vite with proper hot-reload support.
[@theme_vite](https://github.com/theme_vite)('resources/assets/js/app.js')
theme:deleteDelete a theme from the filesystem.
php artisan theme:delete {theme} [options]
Arguments:
theme - Theme name or slugOptions:
--force - Skip confirmation promptExamples:
# Interactive deletion
php artisan theme:delete portfolio
# Force deletion
php artisan theme:delete portfolio --force
Note: Only themes marked as
removable: trueintheme.jsoncan be deleted without--force.
theme:cloneClone an existing theme to create a new one.
php artisan theme:clone {source} {destination}
Arguments:
source - Source theme name or slugdestination - New theme nameExample:
php artisan theme:clone portfolio portfolio-dark
This creates a complete copy with updated metadata.
theme:publishPublish theme assets to the public directory.
php artisan theme:publish {theme?}
Arguments:
theme - Theme name or slug (optional, publishes all if not provided)Examples:
# Publish all themes
php artisan theme:publish
# Publish specific theme
php artisan theme:publish portfolio
theme:devStart Vite development server for a theme.
php artisan theme:dev {theme}
Arguments:
theme - Theme name or slug (optional, auto-detects active theme if omitted)Example:
# Start dev server for specific theme
php artisan theme:dev portfolio
# Start dev server for the currently active theme automatically
php artisan theme:dev
This runs npm run dev in the theme's directory with hot module replacement.
theme:buildBuild production assets for a theme.
php artisan theme:build {theme}
Arguments:
theme - Theme name or slugExample:
php artisan theme:build portfolio
This runs npm run build to compile optimized production assets.
theme:npmRun NPM commands in a theme's context.
php artisan theme:npm {theme} {command}
Arguments:
theme - Theme name or slugcommand - NPM command to runExamples:
# Install dependencies
php artisan theme:npm portfolio install
# Add a package
php artisan theme:npm portfolio "add alpinejs"
# Run custom script
php artisan theme:npm portfolio "run custom-script"
theme:lintLint and automatically format a specific theme's PHP code (using Laravel Pint) and frontend assets (using NPM format or lint scripts).
php artisan theme:lint {theme?} [options]
Arguments:
theme - Theme name or slug (optional, uses active theme if not provided)Options:
--php - Only lint PHP files--assets - Only lint frontend JS/CSS assetsExamples:
# Lint both PHP and assets for the active theme
php artisan theme:lint
# Lint specific theme
php artisan theme:lint portfolio
# Only run Laravel Pint on the theme's PHP files
php artisan theme:lint portfolio --php
theme:cacheCache theme discovery for production performance.
php artisan theme:cache
This creates a cache file at bootstrap/cache/themes.php containing all discovered themes.
theme:clearClear the theme discovery cache.
php artisan theme:clear
Use this after adding, removing, or modifying themes during development.
theme:checkValidate theme structure and dependencies.
php artisan theme:check {theme?}
Arguments:
theme - Theme name or slug (optional, checks all if not provided)Checks:
Example:
php artisan theme:check portfolio
theme:upgradeUpgrade themes to the latest asset structure.
php artisan theme:upgrade {theme?}
Arguments:
theme - Theme name or slug (optional, upgrades all if not provided)What it does:
package.json and vite.config.jsthemer:install to configure NPM workspacesthemer:installInstall and configure Laravel Themer.
php artisan themer:install
What it does:
config/themer.phpthemes/ directorypackage.jsonLaravel Themer extends standard Laravel and Livewire commands to be theme-aware.
make:livewireCreate Livewire components in a theme.
php artisan make:livewire {name} --theme={theme}
Example:
php artisan make:livewire home --class --theme=portfolio
Creates:
themes/portfolio/app/Livewire/Home.phpthemes/portfolio/resources/views/livewire/home.blade.phplivewire:layoutCreate a Livewire layout in a theme.
php artisan livewire:layout --theme={theme}
Example:
php artisan livewire:layout --theme=portfolio
Creates themes/portfolio/resources/views/layouts/app.blade.php.
make:componentCreate Blade components in a theme.
php artisan make:component {name} --theme={theme}
Example:
php artisan make:component button --theme=portfolio
make:viewCreate views in a theme.
php artisan make:view {name} --theme={theme}
Example:
php artisan make:view welcome --theme=portfolio
How can I help you explore Laravel packages today?