Skip to content

πŸ’ͺ Creating your first module

JoΓ£o Ferreira edited this page Jun 30, 2024 · 2 revisions

Usage

To create the module, just do:

php artisan modulify:make your_module_name

Or, if you're using sail:

sail artisan modulify:make your_module_name

Example

Let's say we want to create the Users module for our laravel app, then we would do this:

php artisan modulify:make Users

It will automatically create a module called Users in the App\Modules\ directory with the following structure:

Path Meaning
App\Modules\Database Everything database related
App\Modules\Database\Migrations Module migrations
App\Modules\Http\Controllers Module controllers
App\Modules\Models Module models
App\Modules\Routes Module routes
App\Modules\Providers Module providers, including the default service provider
App\Modules\Resources\views Module views

This will automatically register the module in laravel's providers (bootstrap\providers.php) file, if you delete the module manually be sure to remove it from there too!

Clone this wiki locally