alizharb/laravel-themer

Bridge package connecting hexadog/laravel-themes-manager with Livewire 4 and nwidart/laravel-modules

Fund package maintenance!
alizharb

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/alizharb/laravel-themer

v1.0.0 2026-01-17 01:01 UTC

This package is auto-updated.

Last update: 2026-01-17 01:14:02 UTC


README

Laravel Themer Banner

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Bridge package connecting hexadog/laravel-themes-manager with Livewire 4 and nwidart/laravel-modules.

This package makes hexadog/laravel-themes-manager work seamlessly with Livewire 4 components and nwidart/laravel-modules Blade views, providing theme-aware component resolution and preventing namespace collisions.

Features

  • Livewire 4 Theme Integration: Create and resolve Livewire components in themes
  • Module Theme Support: Override module Blade views with theme-specific versions
  • Namespace Collision Prevention: Separate namespaces for modules (blog::) and themes (theme-admin::)
  • Extended Make Command: make:livewire --theme=admin for easy component creation
  • Works with livewire-modular: Full compatibility when both packages are installed
  • Non-Breaking: Extends existing finders without breaking Livewire or Laravel functionality

Requirements

  • PHP 8.3 or higher
  • Laravel 12.0 or higher
  • Livewire 4.0 or higher
  • hexadog/laravel-themes-manager 3.0 or higher

Installation

composer require alizharb/laravel-themer

The package will automatically register its service provider.

Usage

Creating Livewire Components in Themes

# Create single-file component in theme
php artisan make:livewire Header --theme=admin --sfc

# Create multi-file component in theme
php artisan make:livewire UserMenu --theme=admin --mfc

# Create page component in theme
php artisan make:livewire pages::dashboard --theme=admin --sfc

# Works with livewire-modular (if installed)
php artisan make:livewire PostEditor --module=Blog --theme=admin

Using Theme Components in Blade

{{-- Livewire component in theme --}}
<livewire:admin::header />

{{-- Page component in theme --}}
<livewire:admin::pages::dashboard />

Module Views with Theme Overrides

{{-- Module view (auto theme-aware) --}}
@include('blog::posts.index')
{{-- Resolves to: Modules/Blog/Themes/admin/resources/views/posts/index.blade.php (if theme active) --}}

{{-- Explicit theme view --}}
@include('theme-admin::layouts.app')
{{-- Resolves to: themes/admin/resources/views/layouts/app.blade.php --}}

Using WithTheme Trait

<?php

use AlizHarb\Themer\Concerns\WithTheme;
use Livewire\Component;

class Dashboard extends Component
{
    use WithTheme;

    public function render()
    {
        return view($this->themedView('dashboard'))
            ->layout($this->themedView('layouts.app'));
    }
}

How It Works

Component Resolution Priority

Livewire Components:

  1. themes/{theme}/livewire/{component} (theme-specific)
  2. app/Livewire/{component} (Livewire default)

With livewire-modular installed:

  1. Modules/{Module}/Themes/{Theme}/livewire/ (module theme override)
  2. themes/{Theme}/livewire/ (theme)
  3. Modules/{Module}/Livewire/ (module)
  4. app/Livewire/ (app)

Blade Views:

  1. Modules/{Module}/Themes/{Theme}/resources/views/{view} (module theme override)
  2. themes/{Theme}/resources/views/modules/{module}/{view} (theme module override)
  3. themes/{Theme}/resources/views/{view} (theme default)
  4. Modules/{Module}/resources/views/{view} (module default)
  5. resources/views/{view} (Laravel default)

Namespace Collision Prevention

  • Modules: blog::posts.index (no prefix)
  • Themes (Blade): theme-admin::layouts.app (prefixed with theme-)
  • Themes (Livewire): admin::header (no prefix, different resolution system)

This prevents conflicts when a module and theme have the same name.

Directory Structure

your-app/
├── themes/
│   └── admin/                         # hexadog theme
│       ├── resources/
│       │   └── views/
│       │       ├── layouts/
│       │       └── modules/           # Module view overrides
│       │           └── blog/
│       └── livewire/                  # Theme Livewire components
│           ├── Header.php
│           └── Footer.php
├── Modules/                           # nwidart modules
│   └── Blog/
│       ├── Livewire/
│       │   └── PostList.php
│       ├── Themes/                    # Module theme overrides
│       │   └── admin/
│       │       ├── resources/views/
│       │       └── livewire/
│       └── resources/views/
└── app/
    └── Livewire/

Integration with Other Packages

hexadog/laravel-themes-manager

This package extends hexadog's theme system to work with Livewire 4 and modules. All hexadog features continue to work normally.

alizharb/livewire-modular

When both packages are installed, you get full module + theme + Livewire integration:

# Create component in module theme
php artisan make:livewire PostEditor --module=Blog --theme=admin

Resolution priority becomes: Module Theme → Theme → Module → App

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.