proceed as follows.
1) Add "--dev" to your composer require commands. ie
sudo composer require barryvdh/laravel-ide-helper --dev
Alternatively, in composer.json move your development environment requires into a "require-dev" section:
"require": {
"laravel/framework": "5.0.*"
},
"require-dev": {
"laracasts/generators": "~1.1",
"barryvdh/laravel-ide-helper": "~2.0",
"barryvdh/laravel-debugbar": "~2.0"
},
then do a composer update.
2) Set up a new ServiceProvider:
php artisan make:provider LocalEnvironmentServiceProvider
3) in config/app add the LocalEnvironmentServiceProvider to the providers array:
'providers' => [ ...
'app\Providers\ConfigServiceProvider',
'app\Providers\EventServiceProvider',
'app\Providers\RouteServiceProvider',
/*
* Our Local Environment Service Providers...
*/
'app\Providers\LocalEnvironmentServiceProvider',
],
4) Modify your new app/Providers/LocalEnvironmentServiceProvider file:
<?php namespace App\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class LocalEnvironmentServiceProvider extends ServiceProvider {
/**
* List of Local Environment Providers
* @var array
*/
protected $localProviders = [
'Laracasts\Generators\GeneratorsServiceProvider'
'Barryvdh\Debugbar\ServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
];
/**
* List of only Local Environment Facade Aliases
* @var array
*/
protected $facadeAliases = [
'Debugbar' => 'Barryvdh\Debugbar\Facade',
];
/**
* Bootstrap the application services.
* @return void
*/
public function boot() {
if ($this->app->isLocal()) {
$this->registerServiceProviders();
$this->registerFacadeAliases();
}
}
/**
* Register the application services.
* @return void
*/
public function register() {
}
/**
* Load local service providers
*/
protected function registerServiceProviders() {
foreach ($this->localProviders as $provider) {
$this->app->register($provider);
}
}
/**
* Load additional Aliases
*/
public function registerFacadeAliases() {
$loader = AliasLoader::getInstance();
foreach ($this->facadeAliases as $alias => $facade) {
$loader->alias($alias, $facade);
}
}
}
I added a couple of other typical development providers and facades in there as well, so hopefully you get the gist of how easy it is to extend this.
Of course with this method you can simply change $this->app->isLocal() to match other environments too.