Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Modular Livewire

Modular Livewire Laravel Package

internachi/modular-livewire

Livewire plugin for internachi/modular that auto-discovers and registers Livewire v3 components from your application modules. Scans each module’s src/Livewire directory and registers components as {module}::{kebab-name} with dot notation for subfolders.

View on GitHub
Deep Wiki
Context7

Livewire plugin for internachi/modular

Frequently asked questions about Modular Livewire
How do I install modular-livewire in a Laravel project?
Run `composer require internachi/modular-livewire`—the package auto-registers via Laravel’s package discovery, so no additional configuration is needed. Ensure you’re using Laravel 11+, PHP 8.3+, and internachi/modular ^3.0.
What’s the directory structure for Livewire components in modular-livewire?
Place Livewire components in each module’s `src/Livewire/` directory. For example, `app-modules/billing/src/Livewire/InvoiceTable.php` becomes `billing::invoice-table`. Subdirectories use dot notation (e.g., `Reports/MonthlySummary.php` → `billing::reports.monthly-summary`).
Does modular-livewire support nested Livewire components?
Yes, subdirectories within `src/Livewire/` are converted to dot notation in the component name. For example, `app-modules/reports/src/Livewire/Monthly/Chart.php` registers as `reports::monthly.chart`. This works recursively for any depth of nesting.
Will this work with existing global Livewire components?
No, modular-livewire only auto-discovers components in module-specific `src/Livewire/` directories. Existing global components must be manually migrated to modules or kept separate. There’s no backward compatibility for legacy components.
Can I customize the naming convention (e.g., PascalCase instead of kebab-case)?
Currently, the package enforces kebab-case for class names and dot notation for subdirectories. Custom naming resolvers aren’t built-in, but you could extend the plugin or pre-process class names in your module’s boot method if needed.
What Laravel and Livewire versions are supported?
modular-livewire requires **Laravel 11+**, **PHP 8.3+**, **internachi/modular ^3.0**, and **Livewire ^3.0**. It leverages Laravel’s package discovery and Livewire 3’s server-side reactivity, so downgrading isn’t supported.
How does performance scale with hundreds of modules/components?
The package scans modules on boot, which could add overhead for large apps. Mitigation strategies include lazy-loading components or caching discovery results. For apps with thousands of components, consider testing startup time or splitting modules into plugins.
What if a module doesn’t have a `src/Livewire/` directory?
Nothing breaks—modular-livewire silently skips modules without `src/Livewire/`. This is intentional to avoid errors during discovery. You can add the directory later or use a fallback like manual Livewire registration for that module.
Are there alternatives to modular-livewire for modular Livewire components?
If you’re not using `internachi/modular`, alternatives include manually registering components in a service provider or using Laravel’s `Livewire::component()` in a module’s boot method. However, modular-livewire automates this for modular apps, reducing boilerplate.
How do I test components registered by modular-livewire in PHPUnit?
Test components like any Livewire component, but ensure your module is loaded (e.g., via `Modules::load('billing')`). Use Livewire’s testing helpers (e.g., `Livewire::test('billing::invoice-table')`) in your test cases. Mock dependencies if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle