- What is codions/laravel-modules-livewire?
- It is a Laravel package that adds Livewire support to modular applications built with the laravel-modules package. It automatically registers Livewire components found in each module and supports an Artisan-driven workflow for generating components inside modules. This helps keep module views and logic self-contained.
- How do I install codions/laravel-modules-livewire?
- Install it with Composer using composer require codions/laravel-modules-livewire. Your application should already have Livewire and the laravel-modules package installed and configured. After installation, review the README for any optional configuration publishing or setup steps.
- Does it work with nwidart/laravel-modules?
- Yes, it is designed for Laravel applications using the laravel-modules package to organize code into modules. It integrates with that module structure so Livewire components can live inside modules. Check the package's composer requirements to confirm compatibility with your installed laravel-modules version.
- How are Livewire components auto-registered for each module?
- The package automatically registers Livewire components for every module, removing the need to manually list each component in a service provider. Components placed in a module's expected Livewire namespace and directory are available to Livewire without extra wiring. Refer to the README for the exact directory and namespace conventions.
- How do I create a Livewire component inside a module?
- Use the package's Artisan generator to create the component within a specific module, following the command syntax shown in the README. The generated class and view stay inside the module rather than the main application. After generation, you can render it from the module's Blade views like any Livewire component.
- Where should module Livewire component classes and views live?
- Keep component classes and Blade views inside the module's own directories, following the package's expected structure. This preserves module self-containment and lets auto-registration find the components. The README documents the exact paths and namespaces to use.
- Which Laravel and Livewire versions are supported?
- The package targets Laravel applications that already use Livewire and laravel-modules. Exact Laravel and Livewire version constraints are defined in the repository's composer.json and README. Check those constraints before installing or upgrading to avoid incompatibilities.
- Do I need to configure each module separately?
- In most cases no, because the package's main value is automatic registration of Livewire components across modules. You may still need standard module setup, such as enabling the module and ensuring its namespaces and autoloading are correct. Optional package configuration can be published if the README requires it.
- Can I render module Livewire components in module Blade views?
- Yes, once a module component is generated and registered, you can render it from Blade using Livewire's normal rendering syntax, such as <livewire:component-name />. The component's logic and view remain inside the module. Use the component alias or class name expected by Livewire.
- How do I test module Livewire components before deploying?
- Test them like standard Livewire components, for example with Livewire::test(YourModuleComponent::class). Make sure the module's classes are autoloaded and the component is resolvable in the test environment. For production, pin a stable package version, run your module and Livewire test suite, and cache configuration and routes as usual.