I am building a laravel 5 modular application which the administrators will enable/disable functionalities(modules/packages) from backend.People say that I can have modular functionality with packages in laravel.So, I am using laravel packages as modules.As far as I know, we have to modify composer.json and app.php to install & uninstall a laravel package with composer or manually.I can modify those from my backend php scripts do dynamically enable/disable packages but I am not sure this is a recommended way to dynamically enable/disable laravel packages. So, can anyone tell me a recommended way to do this functionality please.
Asked
Active
Viewed 1,900 times
1
-
I got it now by following this : [link](https://github.com/bstrahija/laravel-modules-example) – Nay Lin Aung May 05 '15 at 22:56
1 Answers
2
Check this link:
Conditionally loading service providers
// AppServiceProvider.php
public function register()
{
$this->app->bind(
'Illuminate\Contracts\Auth\Registrar',
'App\Services\Registrar'
);
if ($this->app->environment('production')) {
$this->app->register('App\Providers\ProductionErrorHandlerServiceProvider');
} else {
$this->app->register('App\Providers\VerboseErrorHandlerServiceProvider');
}
}