Download the PHP package thomasderooij/laravel-modules without Composer

On this page you can find all versions of the php package thomasderooij/laravel-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-modules

Laravel Modules

Build Status License

Install

Require this package with composer using the following command:

Docs

This package enables you to use the Laravel framework with separate modules for code that can be disabled and have dependencies on other modules. A workbench is provided to keep track of the module you're currently working on, and all command, such as "make:controller" apply to the module currently in your workbench. Each module has all functionality the vanilla Laravel has, and has service providers which are included in the project via a composite provider.

Getting started

To get started, run the following commands:

Commands

To manage your modules, you can use the following commands are provided:

This creates a new module in your modules directory, and sets it to your workbench. It will also ask about its dependencies. If your module, called Users, is dependent on another module, called Auth, you can specify this here, and it will take this into account when running database migrations.

This deletes a module and all of the code it contains. Only use this when you are sure you don't need the code in this module. If you are unsure, use the deactivate command.

This deactivates a module. This means the code will remain intact, but the commands, controllers and routes are not recognised, and as far as the software is concerned, do not exist.

This reactivates a deactivated a module.

This sets one of your modules to your workbench. This is set in your local cache, and will expire in 1 week.
The only advantage to this is when you call a make command, it will apply to the module in your workbench. To apply this to another module, add --module=your-module-here-case-insensitive and it will apply it to whatever module you wish, as long as it exists

This clears your workbench

This tells you which module, if any, is currently in your workbench

This allows you to add dependencies so your module, indicating your module cannot function without the upstream module. Circular references are not allowed. E.g., Module Auth can not depend on User as long as module User is dependent on Auth. If this is the case, you should probably consider making this just 1 module, instead of 2. This command will only show you modules that are not downstream of your current module.

This is the inverse of the add-dependency command. It shows you which dependencies your module has, and it allows you to remove any or all of these.

Directory structure

When creating a new module, your directory structure will look as follow:

.
├── app
├── bootstrap
├── config
├── database
├── modules<this is the default>
│   └── YourModule
│   │   ├── Console
│   │   │   └── Kernel.php
│   │   ├── Http
│   │   │   └── Controllers
│   │   │       ├── Controller.php
│   │   ├── Providers
│   │   │   ├── AuthServiceProvider.php
│   │   │   ├── BroadcastServiceProvider.php
│   │   │   ├── EventServiceProvider
│   │   │   └── RouteServiceProvider
│   │   └── routes
│   │       ├── api.php
│   │       ├── console.php
│   │       └── web.php
│   └── .tracker
├── public
├── resources
├── routes
├── storage
├── tests
└── vendor

The .tracker file keeps track of the modules you have and their dependencies.
All directories you're not seeing, like Database, Events, Jobs, Exceptions etc. will be created when the make command is invoked.
If you're having issues with PHPUnit, make sure you add your modules test directory to your phpunit.xml file.

Laravel Commands

Make

All the make commands will apply to the module in your workbench and can be overwritten by using --module option. If there is no module in your workbench and the --module option is not used, the commands will display vanilla Laravel behaviour. To explicitly refer to the vanilla Laravel directories, you can use the --module=vanilla option.

For any models, when creating the model using the make:model command, the HasFactory trait refers to this library's trait. Should your model not find a factory, check if the model refers to the correct trait.

Migrate

The migrate command looks at your module dependencies, and migrates them based on that. So make sure your downstream migrations don't reference your upstream migrations, because that would be trouble.
Both the migrate and the migrate:fresh commands have a --modules option, in case you don't want to use your dependencies and will migrate the modules in the order they are provided in. The modules should be comma separated, as displayed below

Migrating multiple modules in one command will make a separate migration batch per module.

Bugs and unexpected behaviour

This project seems to be pretty functional, but might have bugs. Should you find any bugs or encounter unexpected behaviour, feel free to create an issue.

Settings

In the settings, you will find a few things:

The vanilla Laravel name is just a module name for the default behaviour. If you want to change that name, either change it in the config/modules file, or add 'MODULES_VANILLA={your preferred name here}' to your .env file

Roadmap

The following things are planned, loosely

In that order. Probably.

License

This Laravel add-on is open-source software licensed under the MIT license.


All versions of laravel-modules with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thomasderooij/laravel-modules contains the following files

Loading the files please wait ....