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.
bootstrap/cache/themes.php cache eliminates filesystem scans in production, aligning with Laravel’s optimized bootstrapping. This reduces cold-start latency and improves scalability for high-traffic applications.@vite tags.?preview_theme=slug), useful for admin dashboards or internal tools. Requires careful handling of signed URLs to avoid CSRF risks.theme.json to trigger Artisan commands (e.g., after_activate), enabling workflow automation (e.g., seeding data post-theme activation). Risk of command injection if not sanitized.ThemeManager::macro().Route::middleware(['preview_theme'])->group(...)).theme.json:
{
"hooks": {
"after_activate": ["php artisan db:seed --class=EcommerceSeeder"]
}
}
mix-manifest.json logic with @vite directives in Blade:
@vite(['resources/themes/current/css/app.css'])
theme:upgrade, but custom theme.json hooks may require manual validation for non-MySQL databases.vite.config.js per theme).public/themes/{slug}/assets).php artisan theme:cache) may be needed after theme updates. Risk of stale themes if not automated (e.g., via theme-updated events).theme.json hooks execute arbitrary commands. Validate inputs and restrict to trusted themes.useBuildDirectory behavior).preview_theme) may conflict with existing routing logic. Use middleware groups or custom prefixes.bootstrap/cache/themes.php and Blade/X-Cache invalidated post-theme update? Are there event listeners (e.g., ThemeUpdated)?@alpinejs) handled?theme.json hooks sanitized to prevent command injection? Example: after_activate: ["rm -rf /"].PreviewThemeMiddleware generated and validated? Is CSRF protection included?PreviewThemeMiddleware support tenant-aware previews (e.g., ?preview_theme=slug&tenant=acme)?theme.json hooks system? Is backward compatibility guaranteed?assertThemeHookExecuted())?ThemeManager integrate natively with Laravel’s service container and bootstrapping.@vite directives in Livewire components.GET /api/themes/preview?slug=admin).fileinfo and mbstring.theme.json or custom theme configs for hooks/commands.@vite directives).composer require alizharb/laravel-themer:^1.3.php artisan theme:upgrade to migrate legacy themes.theme:lint and theme:dev wizards for DX improvements.@vite tags in Blade/Livewire.PreviewThemeMiddleware for admin previews:
Route::middleware(['preview_theme'])->group(function () {
Route::get('/admin', AdminController::class);
});
theme.json hooks for automation (e.g., post-activation seeding).resources/themes/admin/vite.config.js).vite.config.js to support theme isolation:
export default defineConfig({
build: {
outDir: `../../public/themes/${process.env.THEME_SLUG}/assets`,
},
});
php artisan theme:cache and verify production boot times.ThemeManager to bypass zero-IO cache.vite.config.js merge strategies.PreviewThemeMiddleware may clash with auth middleware. Order matters (e.g., run after auth but before global middleware).theme.json hooks could cause race conditions. Use queues for long-running commands.theme:upgrade handles schema changes, but custom theme.json hooks may need manual validation for SQLite/PostgreSQL.php artisan theme:cache).theme:lint and wizards in development.@vite directives.PreviewThemeMiddleware for admin routes.theme.json hooks (e.g., after_activate).replace in composer.json for internal forks if needed (e.g., custom hook sanitization).app/Exceptions/Handler.php.How can I help you explore Laravel packages today?