Download the PHP package megaads/clara without Composer
On this page you can find all versions of the php package megaads/clara. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package clara
Clara
A module management in Laravel
System requirements
- PHP: >=5.6
- Laravel Framework: >=5.4
Installation
Clara is packed as a composer package. So it can be installed quickly:
-
Require the composer package
composer require megaads/clara
-
Register the provider:
Megaads\Clara\Providers\ModuleServiceProvider
-
Register the facade:
Megaads\Clara\Facades\ModuleFacade
- Autoloading
By default, Module classes are not loaded automatically. You can autoload your modules in composer.json
- Publish Clara configurations
To override Clara default configuration options, you will need to publish Clara configuration file to the application's config directory.
Module Management
Create module
Naming conventions
Module names should follow UpperCamelCase
syntax (without any space characters). For example: FacebookComment
and module namespace in kebab-case
that correspond to a module name in CamelCase
. For example: facebook-comment
Folder structure
module.json
: the module configuration file is based oncomposer.json
form. All properties in themodule.json
will be merged tocomposer.json
of the project.start.php
: the module's start file that will be loaded every requests. So module actions, module views... can be registered in this file.
Module installing
Install a module using the module name
Clara takes the name of the module that requested to search for it in the app repository that you have registered in config/clara.php
configuration, after downloading the module files, Clara adds the module configuration to the module.json
file
Install module list from module.json
This will searches and downloads the modules listed in module.json
from the app repository into the app/Modules/
directory
Install a module from a zip file or an URL
Enable a module
Disable a module
Remove a module
Remove all modules
Module Action
Fire a action
Using PHP
Using blade statement
Handle a action
Handle a action using a controller
By default, Clara supplies actions:
- module_made
- module_loaded
- module_disabled
- module_enabled
- module_removed
- module_removed_all
Module View
Register a view
Using PHP
Using blade statement
Handle a view
Handle a view using a controller
Module variable
Register a variable
Using PHP
Using blade statement
Handle a variable
Module Assets
Clara will create a symbol link from module asset directory app/Modules/{ModuleName}/Resources/Assets
to public/modules/{module-namespace}
while a module was installed, made or enabled.
Include a module asset
Using PHP
Using blade statement
Create module asset link manually
Create module asset link manually for all activated modules
Module Configurations
All of the configuration files for the module are stored in the {ModuleName}/Config
directory
Accessing Configuration Values
Sometimes you may need to access configuration values at run-time. You may do so using the Config
class
Module Utility Methods
Get all modules
Get the current module
Get module options
Set module option
License
The Clara is open-sourced software licensed under the MIT license
Contact us / Instant feedback
Email: [email protected] | [email protected]
If you find a bug, please report it here on Github
All versions of clara with dependencies
laravel/framework Version 5.4.*
megaads/composer-merge-plugin Version *
illuminate/support Version >=5.3
jeremeamia/superclosure Version ^2.4