alizharb/laravel-modular-livewire
Composer 安装命令:
composer require alizharb/laravel-modular-livewire
包简介
The official Livewire bridge for Laravel Modular offering automatic discovery and registration of modular Livewire components.
README 文档
README
Laravel Modular Livewire is the official bridge for Laravel Modular. It enables automatic discovery, registration, and first-class Artisan support for Livewire components within your modular architecture.
✨ Features
- 🔍 Automatic Discovery: Automatically scans and registers Livewire components in
Modules/*/app/Livewire. - 🏗️ Modular Artisan Command: Enhanced
make:livewirecommand with--modulesupport. - 🎨 Namespace Isolation: Components are automatically prefixed with the module name (e.g.,
<livewire:blog::post-list />). - ⚡ Performance Optimized: Intelligent component caching for zero-overhead in production.
- 🩺 Diagnostics Ready: Designed for Laravel Modular 1.2
modular:doctor,modular:status,modular:debug, andmodular:test. - 🤖 Laravel Boost Support: Ships Boost guidance for module-owned Livewire components.
- ✅ Strictly Typed: Fully compatible with PHPStan level 5 (and scalable to level 9).
🚀 Installation
Install the package via Composer (requires alizharb/laravel-modular):
composer require alizharb/laravel-modular-livewire
The service provider will be automatically registered. It will automatically hook into the laravel-modular registry.
📖 Usage
Generating Modular Components
Use the native make:livewire command with the --module flag to generate any Livewire 4 component type.
1. Single-File Components (Default)
The modern Livewire 4 standard. Everything in one .blade.php file.
php artisan make:livewire Status --module=Blog
- Creates:
Modules/Blog/resources/views/livewire/⚡status.blade.php - Identifier:
blog::status
2. Class-Based Components
The traditional separate Class and Template structure.
php artisan make:livewire Analytics --module=Blog --class
- Class:
Modules/Blog/app/Livewire/Analytics.php - View:
Modules/Blog/resources/views/livewire/analytics.blade.php
3. Multi-File Components (MFC)
Perfect for complex components with dedicated JS and CSS.
php artisan make:livewire Dashboard --module=Blog --mfc
- Creates:
Modules/Blog/resources/views/livewire/⚡dashboard/(Directory containing.php,.blade.php,.js,.css)
4. Page Components (Preferred for Routing)
Use the pages:: prefix for full-page components to keep them logically separated from UI fragments.
php artisan make:livewire pages::post.create --module=Blog
- Creates:
Modules/Blog/resources/views/livewire/pages/⚡create.blade.php - Identifier:
blog::pages::post.create
Routing (Livewire 4)
Laravel Modular Livewire fully supports Livewire 4's native Route::livewire() for full-page modular components.
Using Class-based Routes
use Modules\Blog\Livewire\Analytics; use Illuminate\Support\Facades\Route; Route::livewire('/blog/analytics', Analytics::class);
Using Modular Aliases
// Resolves to the single-file or class-based component Route::livewire('/blog/status', 'blog::status'); // Full-page component via modular alias Route::livewire('/blog/create', 'blog::pages::post.create'); // Example from Test module Route::livewire('/blog/create', 'blog::pages::post.create');
Using Components in Blade
In your Blade views, use the module's alias as the namespace:
{{-- Traditional or Single-file --}} <livewire:blog::status /> {{-- Specialized Page Components --}} <livewire:blog::pages::post.create /> {{-- Example from Blog module --}} <livewire:blog::pages::post.create />
⚙️ Configuration
The bridge respects your existing modular.php paths and Livewire's own configuration. No additional configuration is required.
Diagnostics
After changing module Livewire paths or manifests, run:
php artisan modular:doctor php artisan modular:check php artisan modular:test Blog
If alizharb/laravel-themer is installed, the make:livewire bridge also supports --theme=theme-slug for theme-scoped Livewire components.
📦 Related Packages
Explore the rest of the Laravel Modular ecosystem:
- Laravel Modular - The core modular system.
- Laravel Modular Filament - Filament integration for modular applications.
- Laravel Hooks - Event-driven hooks for modular communication.
- Laravel Themer - Theme management for modular applications.
🧪 Testing
vendor/bin/pest
🤝 Contributing
Please see CONTRIBUTING for details.
📄 License
The MIT License (MIT). Please see License File for more information.
Made with ❤️ by Ali Harb
alizharb/laravel-modular-livewire 适用场景与选型建议
alizharb/laravel-modular-livewire 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「modules」 「laravel」 「modular」 「laravel-modular」 「livewire」 「automatic-discovery」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alizharb/laravel-modular-livewire 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alizharb/laravel-modular-livewire 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alizharb/laravel-modular-livewire 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is Paymorrow module for OXID eShop.
Silverstripe content blocks module
Analysis module for finding problematical shop data.
yii2 swiper slider
An interactive tour through the TYPO3 backend.
Enterprise-Grade Modular Architecture for Laravel Applications - A powerful Laravel package that revolutionizes application development with robust Service Repository Pattern, Dynamic Module Management, and 50+ Artisan commands for scalable, maintainable applications.
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 6
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-24