Skip to content

Commit 0b69cc2

Browse files
committed
Use config publisher
1 parent 9ad5b99 commit 0b69cc2

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed
File renamed without changes.

readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ Require this package with composer:
4545
composer require barryvdh/laravel-debugbar
4646
```
4747

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

61-
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`
61+
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`
6262
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.
6363
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)
6464

65+
Copy the package config to your local config with the publish command:
66+
6567
```
66-
php artisan config:publish barryvdh/laravel-debugbar
68+
php artisan vendor:publish
6769
```
6870

6971
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)`)

src/ServiceProvider.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ function ($request, $response) use ($app) {
6666
*/
6767
public function register()
6868
{
69-
$this->app['config']->set('debugbar', require __DIR__ .'/../config/config.php');
69+
$configPath = __DIR__ . '/../config/debugbar.php';
70+
$this->loadConfigFrom('debugbar', $configPath);
71+
$this->publishes([$configPath => config_path('debugbar.php')]);
7072

7173
$this->app->alias(
7274
'DebugBar\DataFormatter\DataFormatter',
@@ -105,4 +107,18 @@ public function provides()
105107
{
106108
return array('debugbar', 'command.debugbar.clear');
107109
}
110+
111+
/**
112+
* Register the package defaults.
113+
*
114+
* @param string $key
115+
* @param string $path
116+
* @return void
117+
*/
118+
protected function loadConfigFrom($key, $path)
119+
{
120+
$defaults = $this->app['files']->getRequire($path);
121+
$config = $this->app['config']->get($key, []);
122+
$this->app['config']->set($key, array_merge($defaults, $config));
123+
}
108124
}

0 commit comments

Comments
 (0)