Skip to content

Commit

Permalink
Use config publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Jan 26, 2015
1 parent 9ad5b99 commit 0b69cc2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
File renamed without changes.
10 changes: 6 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Require this package with composer:
composer require barryvdh/laravel-debugbar
```

After updating composer, add the ServiceProvider to the providers array in app/config/app.php
> Note for Laravel 5: If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
After updating composer, add the ServiceProvider to the providers array in config/app.php
> If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
```
'Barryvdh\Debugbar\ServiceProvider',
Expand All @@ -58,12 +58,14 @@ If you want to use the facade to log messages, add this to your facades in app.p
'Debugbar' => 'Barryvdh\Debugbar\Facade',
```

The profiler is enabled by default, if you have app.debug=true. You can override that in the config (`debugbar.enabled`). See more options in `config/config.php`
The profiler is enabled by default, if you have app.debug=true. You can override that in the config (`debugbar.enabled`). See more options in `config/debugbar.php`
You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.
You can also only display the js of css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)

Copy the package config to your local config with the publish command:

```
php artisan config:publish barryvdh/laravel-debugbar
php artisan vendor:publish
```

You can also disable/enable the loggers you want. You can also use the IoC container to add extra loggers. (`$app['debugbar']->addCollector(new MyDataCollector)`)
Expand Down
18 changes: 17 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ function ($request, $response) use ($app) {
*/
public function register()
{
$this->app['config']->set('debugbar', require __DIR__ .'/../config/config.php');
$configPath = __DIR__ . '/../config/debugbar.php';
$this->loadConfigFrom('debugbar', $configPath);
$this->publishes([$configPath => config_path('debugbar.php')]);

$this->app->alias(
'DebugBar\DataFormatter\DataFormatter',
Expand Down Expand Up @@ -105,4 +107,18 @@ public function provides()
{
return array('debugbar', 'command.debugbar.clear');
}

/**
* Register the package defaults.
*
* @param string $key
* @param string $path
* @return void
*/
protected function loadConfigFrom($key, $path)
{
$defaults = $this->app['files']->getRequire($path);
$config = $this->app['config']->get($key, []);
$this->app['config']->set($key, array_merge($defaults, $config));
}
}

0 comments on commit 0b69cc2

Please sign in to comment.