vinevax/modular-laravel

Simplify creating modular Laravel applications

1.1.0 2023-12-13 19:25 UTC

This package is auto-updated.

Last update: 2024-05-11 17:01:55 UTC


README

License Latest Version on Packagist Total Downloads

This packages simplifies making your Laravel application modular.

The structure is inspired by this Laracon Talk from Ryuta Hamasaki (Repository)

Setup

composer require vinevax/modular-laravel
php artisan modules:install

Optional: Publish the config file

php artisan vendor:publish --provider="Vinevax\ModularLaravel\ModularLaravelServiceProvider"

Create a module

php artisan modules:create ModuleName

Fix modules structure

Since empty folders are not in saved in git, you can run the following command, to ensure every folder exists:

php artisan modules:fix

Testing

To enable tests, you need to modify your phpunit.xml configuration. Add the following two test suites (if you've changed the default paths, you may need to change the test path)

<testsuites>
    <testsuite name="Unit">
        <directory suffix="Test.php">./modules/**/Tests/Unit</directory>
    </testsuite>
    <testsuite name="Feature">
        <directory suffix="Test.php">./modules/**/Tests/Feature</directory>
    </testsuite>
</testsuites>