view()->exists()), ensuring familiarity for developers. However, it lacks built-in support for partial overrides (e.g., only overriding a component like a header while inheriting the rest).config/bundles.php (if using Symfony) or Laravel’s service provider registration. This is a low-risk integration if the project already uses a similar pattern (e.g., config/app.php for theme paths).djaney/theming-bundle), which may require adapters (e.g., wrapping Symfony’s Theme class in a Laravel service provider). Feasibility depends on:
HttpKernel, DependencyInjection).ViewFinder).laravel-mix or vite-plugin-themes.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Dependency | High | Abstract Symfony classes behind Laravel interfaces (e.g., ThemeInterface). |
| View Resolution Conflicts | Medium | Test edge cases (e.g., missing child templates, nested overrides). |
| Asset Management | Medium | Extend with a custom asset pipeline or use a companion package. |
| Performance Overhead | Low | Benchmark template resolution vs. native Blade. |
| Documentation Gaps | High | Create Laravel-specific guides (e.g., "How to register themes in config/app.php"). |
laravel-localization or similar? The bundle may need extension for locale-aware themes.HttpKernel for theme-aware routing).Phase 1: Proof of Concept (1–2 weeks)
djaney/theming-bundle).resources/views/base) and child theme (resources/views/child).child/layouts/app.blade.php) to verify inheritance.Phase 2: Core Integration (2–3 weeks)
config/app.php or a custom config file:
'themes' => [
'default' => 'base',
'brand_a' => 'child',
],
ViewFinder to prioritize child themes:
// app/Providers/AppServiceProvider.php
View::addNamespace('themes', resource_path('views'));
public function handle($request, Closure $next) {
$theme = Theme::resolve($request->user()->theme);
app()->setLocale($theme->getLocale());
return $next($request);
}
vite-plugin-themes or custom Mix config.Phase 3: Advanced Features (Optional)
@theme/css/styles.css).laravel-debugbar.| Component | Compatibility Notes |
|---|---|
| Laravel Blade | ✅ Directly supported (template inheritance). |
| Laravel Mix/Vite | ⚠️ Manual setup required (asset path resolution). |
| Symfony Components | ⚠️ High effort to abstract (recommend wrapping in Laravel interfaces). |
| Livewire/Inertia | ⚠️ Limited support (themes apply to Blade; Inertia may need separate CSS variables). |
| Database-Backed Themes | ❌ Not supported (would require custom middleware to fetch themes from DB). |
child/partials/header vs. base/partials/header).djaney/theming-bundle is abandoned, fork or rewrite may be needed.php artisan theme:validate).php artisan theme:list).theme:debug Artisan command to dump active theme and resolved paths.laravel-debugbar to visualize theme resolution.php artisan view:clear)..env to set default themes (e.g., THEME=staging).config('themes.enabled').app() container or Redis for dynamic switching.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Missing child template | Falls back to base (safe). | Log warnings via View::missing(). |
| Symfony |
How can I help you explore Laravel packages today?