Support the ongoing development of Laravel.io →
Configuration Packages Architecture
Last updated 2 years ago.
0

Please be more specific. Most packages are loaded via composer so your development packages would be in the require-dev block. If your talking about credentials then you need to put them in the .env file (renamed from .env.example).

0

In Laravel 4.2 my app/config/local/app.php file looks like this

return [
  'providers' =>  append_config([
                'Way\Generators\GeneratorsServiceProvider'
        ])
];

and my composer.json has the require-dev dependency:

		"way/generators": "1.*"

This way, I can load the GeneratorsServiceProvider only on local development environment

I was wondering how can I achieve the same thing in Laravel 5.

Thanks!

Last updated 9 years ago.
0

While I've never returned the providers array from app.php, that specific file in L4 was an environment file for your "local" environment. There are no environment sub-folders in L5 only the .env file (renamed from .env.example). Another user posted this same question in the Laracasts forum. https://laracasts.com/discuss/channels/general-discussion/l5-append-config-problem

I'm not sure why this needs to be done as your development dependencies/packages will only install and load if you are in your development environment.

0

cringer said:

I'm not sure why this needs to be done as your development dependencies/packages will only install and load if you are in your development environment.

Imagine that you installed way/generators as a require-dev dependency and then registered that service provider in the app.php file. Everything would work fine until you deployed then composer wouldn't install way/generators laravel would throw a error when it tried to load that service provider

0

You could add a new ServiceProvider that you register in your app.php and as part of that you could possibly then detect the environment, and register additional providers and facades in the boot/register method in that service provider.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.