A Laravel package to structure Livewire components in a more organized way.
Require the package via Composer:
composer require wowpack/structured-livewire-componentsPublish the configuration file using the following Artisan command:
php artisan vendor:publish --provider="Wowpack\StructuredLivewire\StructuredLivewireServiceProvider" --tag=configThis will publish the structured-livewire.php config file to your application's config directory.
The configuration file contains the following options:
livewire-components-directory: The base directory where Livewire components are stored. Default isapp/Livewire.groups: Define groups of components with their locations and suffixes.
Example:
return [
'livewire-components-directory' => app_path('Livewire'),
'groups' => [
'pages' => [
'location' => 'Components',
'suffix' => 'components',
],
'components' => [
'location' => 'Components',
'suffix' => 'components',
],
]
];The package automatically registers Livewire components based on the configuration.
You can create structured Livewire components using the provided Artisan command:
php artisan livewire:structured-livewire-component {component-name}You will be prompted to select the group for the component.
This package supports Laravel versions 10, 11, and 12, and Livewire version 3.
MIT License