Skip to content

Instantly share code, notes, and snippets.

@warrickbayman
Last active October 25, 2016 20:42
Show Gist options
  • Save warrickbayman/28a28675513225edcc879af83fe70883 to your computer and use it in GitHub Desktop.
Save warrickbayman/28a28675513225edcc879af83fe70883 to your computer and use it in GitHub Desktop.
Laravel: Load development only packages
<?php
namespace App\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class DevelopmentServiceProvider extends ServiceProvider
{
protected $providers = [
\Barryvdh\Debugbar\ServiceProvider::class
];
protected $facades = [
'Debugbar' => \Barryvdh\Debugbar\Facade::class
];
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
if ($this->app->environment() == 'local') {
foreach ($this->providers as $provider) {
$this->app->register($provider);
}
$loader = AliasLoader::getInstance();
foreach ($this->facades as $alias => $facade) {
$loader->alias($alias, $facade);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment