I am working on a Laravel 5 application, and now the application code should be reused in several laravel 5 applications, so I create a composer package and then I would like to install this package in any number of laravel 5 applications to have the same functionality and create on it also.
I am new to composer package development and especially connect packages to Laravel 5 using service providers. So far, I have learned that if I use a service provider as below, I can use the routes in the laravel 5 application:
<?php namespace Uppdragshuset\AO\Tenant; use Illuminate\Support\ServiceProvider; class TenantServiceProvider extends ServiceProvider { public function boot() {
Now, to make this work, I just require the package through the composer to any new Laravel 5 installation, and then I just need to update the providers array in app.php as follows:
Uppdragshuset\AO\Tenant\TenantServiceProvider::class
It makes sense to me and works. But now the package I'm developing also has its own dependencies, and many of these dependency packages also include laravel 5 service providers, so I have to manually include all of them in the laravel5 installations for them to work.
But I suppose there should be a way to register these dependent service providers in a package that I create myself, so I just need to register one provider mentioned above. The problem is that I do not know how to do this, and I can not find a similar link anywhere. How to register several service providers from the composer package itself?
source share