项目作者: Zingle

项目描述 :
Laravel Modules
高级语言: PHP
项目地址: git://github.com/Zingle/LaravelModules.git
创建时间: 2017-11-15T18:14:22Z
项目社区:https://github.com/Zingle/LaravelModules

开源协议:

下载


Laravel Modules

Build Status
Coverage Status

Simple helpers for adding modular architecture to your Laravel project.

Overview

Modular architecture makes your application easier to understand and
scale. This package attempts to add support for modules with minimal
effort and greatest amount of flexibility. A Module in this package
corresponds with a module grouping of code in your project.

Installation

Install the base package with composer.

  1. $ composer install zingle-com/laravel-modules

Add service provider to your providers after the Illuminate providers,
but before your project service providers.

  1. // config.php
  2. // ...
  3. 'providers' => [
  4. // ...
  5. Illuminate\Validation\ValidationServiceProvider::class,
  6. Illuminate\Session\SessionServiceProvider::class,
  7. Illuminate\Notifications\NotificationServiceProvider::class,
  8. /**
  9. * Vendors
  10. */
  11. // ...
  12. ZingleCom\LaravelModules\ModuleServiceProvider::class,
  13. // ...
  14. /**
  15. * Project providers
  16. */
  17. ],

Finally install the vendor assets:

  1. $ php artisan vendor:publish --provider="ZingleCom\LaravelModules\ModuleServiceProvider::class"

Usage

After defining your modular structure, to create a new module simply
create add a new class that extends Module to your base module
directory that corresponds with the name of the module. For example,
if you had a module named Auth the base directory for which is
app/Modules/Auth you would create the following class:

  1. namespace App\Modules\Auth;
  2. use ZingleCom\LaravelModules\Module\Module;
  3. class AuthModule extends Module
  4. {
  5. }

Then add the new module class to config/modules.php under the modules key like:

  1. // modules.php
  2. // ..
  3. "modules" => [
  4. App\Modules\Auth\AuthModule::class,
  5. ],