Download the PHP package lucidnetworks/laravel-modular without Composer

On this page you can find all versions of the php package lucidnetworks/laravel-modular. 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-modular

Laravel-Modular

Structure to use laravel as modular system

To install this app:

  1. Include "lucidnetworks/laravel-modular": "^1.0" on your require composer.json
  2. Add Lucid\Modular\ModulesServiceProvider::class to your config/app providers array
  3. Run php artisan vendor:publish
  4. Run php artisan migrate

Modules activation or desactivation

To activate or desactivate a module just insert your moduleName on _modules array into your modules config file

Environement configuration

You can specify in your .env file another config file for modules using the key MODULES_CONFIG_FILE Ex: Use MODULES_CONFIG_FILE=modules_my_site tu use file modules_my_site as configuration file, you can otherwise use MODULES_CONFIG_FILE=my_config.modules to specify an array inside my_config file

Create New Module:

  1. Create your module structure with php artisan modules:new ModuleName
  2. Add your module name into _modules inside modules.php or your specific modules configuration file

Modules structure

Module routing:

Module routes must be declarated on boot.php, remember you must to use complete namespaces on all methods called into routes or use the namespace property To use routes with parameters use route key 'params_closure' => function(){} who receives a closure that returns all params nedded to create the route

Route sample: Route::group(['middleware' => ['web','auth'], 'as'=>'admin::', 'namespace' => 'Modules\Admin\Controllers', 'params_closure' => function(){ return ['id' => 23]; }], function() { /* route code */ });

Hooks:

Hooks allow to register funtions that can be called from your app views To add a hook use ModulesManager::attachHook(string Point, string Name, callable Closure) normally hooks must be added into boot.php

[Parameters]:

Hooks ordenation:

Each time ModulesManager::attachHook was called, hook will be saved into database, that's allow to order hook depending your preferences, if you don't set an order all hooks will be ordered between his insertion into database

Hook Example: ModulesManager::attachHook('admin.actionBar','MyModule::HookAction1', function(){ return 'TEST-HOOK'; });

Hooks use:

To get your registered hooks content use ModulesManager::getHook({attach_point}) this will return all html returned by all hooks was registered to this attach_point

Module public methods registration

This tool allow you to register a method that can be called as a hook, but in this case it can returns any kind of result, that allow you to set any method of your module public To register a method as public use ModulesManager::registerModuleFunc(string Name, callable Closure);

[Parameters]:

Calling a module public method

After register a method on your module you can access it from anywhere using ModulesManager::callModuleFunc(string Name, array Params = [], Default = null) or callModuleFuncOrFail with same signature if you want to generate an exception if {method_name} has not been registered

[Parameters]:

callModuleFuncOrFail(string Name, array Params = [],string Message = '') will generate an exception if Name has not been registered, in this case Message it's the message will be show by the generated exception. Ex 'You must to install x module'

Assets:

Each module can have his own public files, to create public content just put ir into your module assets folder, this content will be putted into the next public url {your_laravel_base_url}/modules/{moduleName}/{path_to_your_file_from_assets}

For security reasons ../ is not allowed into paths

ModulesManager utilities:

Application messages:

You can register application messages with the method ModulesManager::displayHeaderMessage(string $message, string $type = 'danger', string $title = '', bool $dismissible = true, string $icon = '') before you can get your messages at any time with ModulesManager::getHeaderMessages() As an example you can register your module error messages and use getHeaderMessages to whow them into your app

Static arrays ::css y ::js

This two static arrays of ModulesManager allow you to inject some css and js filenames from your modules, Ex: ModulesManager::js[] = '/modules/MyModule/js/test.js'

After this you can get all filenames accessing ModulesManager::js or ModulesManager::css wherever you need, as an example you can use this arrays into your header template to load all files needed by your modules

Remember that if you want to use a file from your module assets folder you must to use his public path /modules/{moduleName}/{path_to_your_file_from_assets}

Migrations

To execute your module migrations run artisan modules:migrate ModuleName

If you want to rollback a migration use artisan modules:migrate ModuleName --down

If your modules configuration file is different than modules.php you must specify your config file or config key like this artisan modules:migrate ModuleName YourConfigFile or artisan modules:migrate ModuleName YourConfigFile --down

Tests

To execute your module tests run artisan modules:test ModuleName or just artisan modules:test if you want to run all activated modules tests.

If your modules configuration file is different than modules.php you must specify your config file or config key like this artisan modules:test ModuleName YourConfigFile or artisan modules:test all YourConfigFile for all tests

Remember all test will be runned as if it's into your laravel test folder and not into your module test folder, then all test must to extend from TestBase without any namespace

Artisan commands

You can add your module artisan commands easily, just add into _commands array inside your module config.php file the className for your command. Ex: '_commands' => ['App\Modules\MyModule\commands\testCommand']


All versions of laravel-modular with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laravel/framework Version >=5.1.6
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 lucidnetworks/laravel-modular contains the following files

Loading the files please wait ....