Download the PHP package bchalier/laravel-modules without Composer
On this page you can find all versions of the php package bchalier/laravel-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-modules
Divide your laravel application in modules, the laravel way
Introduction
This package is made to allow you to divide everything laravel allow you to make but divided in modules.
I ended up making this package even if other are doing exactly the same thing because after trying to work with them, after some time I always found them incomplete, no longer maintained, not respecting laravel standards and ideas (having module:make-controller command instead of make:controller, another file structure etc) so after trying 3-4 modules I got frustrated and starting making my own package trying to not reproduce the mistakes I saw earlier.
Here are the result, I hove you will like it as much as I do ! This is my first public package so please fell free to send me any suggestions, questions, bug report, feature request you may have !
Versioning
This package follow Semantic Versioning, see : https://semver.org/
Installation
You can install the package via composer:
Commands
All the standard make commands are extended with a -M|module=[module alias] options, here an example :
As it is an extend and not a replacement all options are available and working (or should be !)
The package also add some commands for dealing with the modules themselves :
- : make one or more new module, use the --fill option to add all possible elements in the newly created module.
- : install one or more module (in bdd)
- : reinstall the module (update bdd), useful
- : uninstall one or more module (keep files, clean bdd)
- : load the module (the files will always be loader by composer but the providers, routes etc will only if the module is enabled)
- : disable the module
- : delete the bdd AND FILES of the module, be careful, this command will delete all your module files and uninstall it.
Structure
The insides of a module is pretty much just a normal laravel, here an example (make it yourselves with ) :
Composer
At the root of your module you have a composer.json, same as the one you know with just a bit extra, you will find an example bellow.
IT DOES NOT INSTALL PACKAGES, would you want to look into wikimedia/composer-merge-plugin but it's not compatible with composer 2.
Here what that mean :
- name : literally whatever you want, simply a cosmetic value.
- alias : this is what you will be using in every command.
- description : a description, duh.
- install.migrate : migrate the migrations on module installation.
- install.createDir : create a dir of you liking on installation.
- loadParameters.compartmentalize.migrations : isolate the migration from the rest of your app, in this example the migration for the modules table will not be called on any of the commands except for the because it drop all tables regardless of migrations, you'll have to install all your modules again after this one.
- providers : list all the providers you want to load in your module.
- aliases : list all the aliases you want to have in your module.
Remember that you will have to call for updating the settings above.
.env
Here are some settings added that may be used in your .env :
That's pretty much it, there probably plenty of room for improvement so I'm waiting your comments on this !