There is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.
Laravel package for generating Laravel Modules from a template.
PHP 8.2+ Laravel Modules package installed https://github.com/nWidart/laravel-modules
https://www.youtube.com/watch?v=BwYzfb9Fa8A&t=2s
You can install the package via composer:
composer require dcblogdev/laravel-module-generator
Publish both the config
and stubs
:
php artisan vendor:publish --provider="Dcblogdev\ModuleGenerator\ModuleGeneratorServiceProvider"
This will publish a module-generator.php
config file
This contains:
'template' => [
'Breeze - Blade - CRUD Web & API' => 'stubs/module-generator/breeze-crud-full',
'Breeze - Blade - CRUD Web only' => 'stubs/module-generator/breeze-crud-web',
'Breeze - Blade - CRUD API only' => 'stubs/module-generator/breeze-crud-api'
],
'ignore_files' => ['module.json']
By default, the stubs will be located at stubs/module-generator you can add your paths by adding folders and updating the config file.
php artisan module:build
![300550938-529c214d-a02a-4577-8904-c865b2f41f7e](https://private-user-images.githubusercontent.com/1018170/300574334-82c0828f-b9d6-4eff-b7ca-908b46fe37e7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQyODMwNzMsIm5iZiI6MTcyNDI4Mjc3MywicGF0aCI6Ii8xMDE4MTcwLzMwMDU3NDMzNC04MmMwODI4Zi1iOWQ2LTRlZmYtYjdjYS05MDhiNDZmZTM3ZTcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjFUMjMyNjEzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2JiYWFmNGI0ZDYwYzIwMThmMmViM2QxMGZmMjY4ZmRlYTljMmFjMjU5YmIwOTBlMjk4OTUyMDBmOGRmMDU1NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.w_Pgbf8LSHqdNNl5s8_5x95bpvW9ofE-Cyp1oreM7ZQ)
{module?} is the name of the module you want to create. If you don't provide a name you will be asked to enter one.
{template?} is the name of the template you want to use. If you don't provide a name you will be asked to enter one.
php artisan module:build Contacts "Breeze - CRUD API only"
Once a module has been created, enable it:
php artisan module:enable ModuleName
Then run:
composer dump-autoload
Create or update the stubs file. The filename and contents should have placeholders for example ModulesController
will be replaced with your name + Controller. ie ContactsController
when the command is executed.
These placeholders are replaced with the name provided when running php artisan module:build
Module
= Module name ie Contacts
module
= Module name in lowercase ie contacts
module_plural
= Plural module name in lowercase ie demo becomes demos
Model
= Model name ie Contact
model
= Model name in lowercase ie contact
{Module}
= Module name ie PurchaseOrders
{module}
= Module name in lowercase ie purchaseOrder
{module_}
= module name with underscores ie purchase_orders
module_plural
= Plural module name in lowercase ie demo becomes demos
{module-}
= module name with hyphens ie purchase-orders
{module }
= module name puts space between capital letters ie PurchaseOrders
becomes Purchase Orders
{Model}
= Model name ie PurchaseOrder
{model}
= Model name in lowercase ie purchaseOrder
{model_}
= model name with underscores ie purchase_orders
{model-}
= model name with hyphens ie purchase-orders
{model }
= model name puts space between capital letters ie PurchaseOrder
becomes Purchase Order
Contributions are welcome and will be fully credited.
Contributions are accepted via Pull Requests on Github.
-
Document any change in behaviour - Make sure the
readme.md
and any other relevant documentation are kept up-to-date. -
Consider our release cycle - We try to follow SemVer v2.0.0. Randomly breaking public APIs is not an option.
-
One pull request per feature - If you want to do more than one thing, send multiple pull requests.
If you discover any security related issues, please email dave@dcblog.dev email instead of using the issue tracker.
license. Please see the license file for more information.