Reputation: 17299
after installing some packages in laravel
we should add class definition to providers
array. as you know we have this array:
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
// ...
App\Providers\AnnotationsServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
],
my question is how can i add class to this array programical? does any ability in laravel to add it? for example:
App::install();
Upvotes: 0
Views: 45
Reputation: 15616
If you're using a later or equal version of Laravel 5.5, you can use your package's composer.json
file to register your classes automatically by using Laravel's package discovery feature:
"extra": {
"laravel": {
"providers": [
"Foo\\Bar\\ServiceProvider"
],
"aliases": {
"Bar": "Foo\\Bar\\Facade"
}
}
}
to add providers and aliases into the application's runtime configuration. Many packages support it now without doing anything.
Upvotes: 1