Package Data | |
---|---|
Maintainer Username: | VirCom |
Maintainer Contact: | kamil.rak@vircom.pl (VirCom) |
Package Create Date: | 2016-09-22 |
Package Last Update: | 2016-10-22 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 15:00:11 |
Package Statistics | |
---|---|
Total Downloads: | 16 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
vircom/laravel-modules-loader is a Laravel package allows you to easy loads modules used in your application.
The recommended way to install Laravel modules loader library is through Composer.
# Install Composer
curl -sS https://getcomposer.org/installer | php
Next, you should run command below, to install the latest stable version of package:
composer.phar require vircom/laravel-modules-loader
Next add the following service provider in config/app.php
.
'providers' => [
VirCom\Laravel\ModulesLoader\ModulesLoaderServiceProvider::class,
],
At least, public modules configuration file:
php artisan vendor:publish --provider="VirCom\Laravel\ModulesLoader\ModulesLoaderServiceProvider"
Controllers, repositories and other module code parts are not loaded by default. At first, you should add to your composer.json lines, to load PSR-4 files. Example:
{
"autoload": {
"psr-4": {
"App\\": "app/",
"YourVendor\\ModuleName\\SubmoduleName\\Module\\": "modules/Module/src/"
}
}
}
Dont forget to run command:
composer dump-autoload
After that, create modules directory and module structre inside it:
modules
+-- src
| +-- Module
| +-- Module.php
Module.php file must be subclass of Illuminate\Support\ServiceProvider larvel provider class. So for example, looks like below:
<?php
namespace YourVendor\ModuleName\SubmoduleName\Module;
use Illuminate\Support\ServiceProvider;
class Module extends ServiceProvider
{
public function register()
{
}
}
At least, add the following line to your: config\modules.php file:
return [
/*
|--------------------------------------------------------------------------
| Modules list
|--------------------------------------------------------------------------
|
| List all of you modules
*/
'YourVendor\ModuleName\SubmoduleName\Module'
];
Thats all. Modules loader automaticly register your module service file.