mdixon18 mdixon18 - 1 year ago 147
PHP Question

Laravel 5 dynamically install a package

So I am relatively new to Laravel so i'm trying to seek some advice. I've read the documentation on packages provided by laravel. Now i understand you need a service provider to connect your package to laravel like so:

. Now what i am trying to do is have a control panel that installs packages straight off of packagist. Now i can manipulate the composer.json file quite easily in code. However, what i am trying to work around is declaring the service provider. I think it would be inconvenient if i have a dynamic installation but you have to declare the service provider yourself. Is there a way i can dynamically register the service provider in Laravel 5?

Answer Source

You can dynamically add service providers through the App facade:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download