Skip to content

Commit d4bc7b1

Browse files
committed
Start of Laravel 5 changes
Remove some checks, change configuration, remove old middleware.
1 parent 99e6f44 commit d4bc7b1

File tree

8 files changed

+41
-140
lines changed

8 files changed

+41
-140
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
"description": "PHP Debugbar integration for Laravel",
44
"keywords": ["laravel", "debugbar", "profiler", "debug", "webprofiler"],
55
"license": "MIT",
6-
76
"authors": [
87
{
98
"name": "Barry vd. Heuvel",
109
"email": "barryvdh@gmail.com"
1110
}
1211
],
1312
"require": {
14-
"php": ">=5.3.0",
15-
"illuminate/support": "4.*|5.0.*",
16-
"symfony/finder": "~2.3",
13+
"php": ">=5.4.0",
14+
"illuminate/support": "5.0.*",
15+
"symfony/finder": "~2.6",
1716
"maximebf/debugbar": "~1.10.2"
1817
},
1918
"autoload": {
@@ -28,5 +27,6 @@
2827
"branch-alias": {
2928
"dev-master": "1.8-dev"
3029
}
31-
}
30+
},
31+
"minimum-stability": "dev"
3232
}
File renamed without changes.

readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Latest Stable Version](https://poser.pugx.org/barryvdh/laravel-debugbar/version.png)](https://packagist.org/packages/barryvdh/laravel-debugbar)
44
[![Total Downloads](https://poser.pugx.org/barryvdh/laravel-debugbar/d/total.png)](https://packagist.org/packages/barryvdh/laravel-debugbar)
55

6-
This is a package to integrate [PHP Debug Bar](http://phpdebugbar.com/) with Laravel.
6+
This is a package to integrate [PHP Debug Bar](http://phpdebugbar.com/) with Laravel 5.
77
It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.
88
It bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel.
99
It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown)
@@ -58,9 +58,7 @@ 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-
~~You need to publish the assets from this package.~~ Since 1.7, you don't need to publish the assets anymore.
62-
63-
The profiler is enabled by default, if you have app.debug=true. You can override that in the config files.
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`
6462
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.
6563
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)
6664

src/Controllers/OpenHandlerController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
use DebugBar\OpenHandler;
44
use Illuminate\Http\Response;
5+
use Illuminate\Routing\Controller;
56

6-
class OpenHandlerController extends BaseController
7+
class OpenHandlerController extends Controller
78
{
89
public function handle()
910
{

src/DataCollector/IlluminateRouteCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function getWidgets()
172172
"default" => "{}"
173173
)
174174
);
175-
if (Config::get('laravel-debugbar::config.options.route.label', true)) {
175+
if (Config::get('debugbar.options.route.label', true)) {
176176
$widgets['currentroute'] = array(
177177
"icon" => "share",
178178
"tooltip" => "Route",

src/LaravelDebugBar.php

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct($app = null)
8282
*/
8383
public function enable()
8484
{
85-
$this->app['config']->set('laravel-debugbar::config.enabled', true);
85+
$this->app['config']->set('debugbar.enabled', true);
8686
if (!$this->booted) {
8787
$this->boot();
8888
}
@@ -127,7 +127,7 @@ function () use ($debugbar, $startTime) {
127127
);
128128

129129
//Check if App::before is already called..
130-
if ($this->checkVersion('4.1-dev', '>=') && $this->app->isBooted()) {
130+
if ($this->app->isBooted()) {
131131
$debugbar->startMeasure('application', 'Application');
132132
} else {
133133
$this->app['router']->before(
@@ -151,16 +151,9 @@ function () use ($debugbar) {
151151
try {
152152
$exceptionCollector = new ExceptionsCollector();
153153
$exceptionCollector->setChainExceptions(
154-
$this->app['config']->get('laravel-debugbar::config.options.exceptions.chain', true)
154+
$this->app['config']->get('debugbar.options.exceptions.chain', true)
155155
);
156156
$this->addCollector($exceptionCollector);
157-
if ($this->checkVersion('5.0-dev', '<')) {
158-
$this->app->error(
159-
function (Exception $exception) use ($exceptionCollector) {
160-
$exceptionCollector->addException($exception);
161-
}
162-
);
163-
}
164157
} catch (\Exception $e) {
165158
}
166159
}
@@ -191,7 +184,7 @@ function (Exception $exception) use ($exceptionCollector) {
191184

192185
if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
193186
try {
194-
$collectData = $this->app['config']->get('laravel-debugbar::config.options.views.data', true);
187+
$collectData = $this->app['config']->get('debugbar.options.views.data', true);
195188
$this->addCollector(new ViewCollector($collectData));
196189
$this->app['events']->listen(
197190
'composing:*',
@@ -210,11 +203,7 @@ function ($view) use ($debugbar) {
210203

211204
if ($this->shouldCollect('route')) {
212205
try {
213-
if ($this->checkVersion('4.1', '>=')) {
214-
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\IlluminateRouteCollector'));
215-
} else {
216-
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\SymfonyRouteCollector'));
217-
}
206+
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\IlluminateRouteCollector'));
218207
} catch (\Exception $e) {
219208
$this->addException(
220209
new Exception(
@@ -265,7 +254,7 @@ function ($level, $message, $context) use ($logger) {
265254
if ($this->shouldCollect('db', true) and isset($this->app['db'])) {
266255
$db = $this->app['db'];
267256
if ($debugbar->hasCollector('time') && $this->app['config']->get(
268-
'laravel-debugbar::config.options.db.timeline',
257+
'debugbar.options.db.timeline',
269258
false
270259
)
271260
) {
@@ -275,20 +264,20 @@ function ($level, $message, $context) use ($logger) {
275264
}
276265
$queryCollector = new QueryCollector($timeCollector);
277266

278-
if ($this->app['config']->get('laravel-debugbar::config.options.db.with_params')) {
267+
if ($this->app['config']->get('debugbar.options.db.with_params')) {
279268
$queryCollector->setRenderSqlWithParams(true);
280269
}
281270

282-
if ($this->app['config']->get('laravel-debugbar::config.options.db.backtrace')) {
271+
if ($this->app['config']->get('debugbar.options.db.backtrace')) {
283272
$queryCollector->setFindSource(true);
284273
}
285274

286-
if ($this->app['config']->get('laravel-debugbar::config.options.db.explain.enabled')) {
287-
$types = $this->app['config']->get('laravel-debugbar::config.options.db.explain.types');
275+
if ($this->app['config']->get('debugbar.options.db.explain.enabled')) {
276+
$types = $this->app['config']->get('debugbar.options.db.explain.types');
288277
$queryCollector->setExplainSource(true, $types);
289278
}
290279

291-
if ($this->app['config']->get('laravel-debugbar::config.options.db.hints', true)) {
280+
if ($this->app['config']->get('debugbar.options.db.hints', true)) {
292281
$queryCollector->setShowHints(true);
293282
}
294283

@@ -316,7 +305,7 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
316305
try {
317306
$mailer = $this->app['mailer']->getSwiftMailer();
318307
$this->addCollector(new SwiftMailCollector($mailer));
319-
if ($this->app['config']->get('laravel-debugbar::config.options.mail.full_log') and $this->hasCollector(
308+
if ($this->app['config']->get('debugbar.options.mail.full_log') and $this->hasCollector(
320309
'messages'
321310
)
322311
) {
@@ -333,7 +322,7 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
333322

334323
if ($this->shouldCollect('logs', false)) {
335324
try {
336-
$file = $this->app['config']->get('laravel-debugbar::config.options.logs.file');
325+
$file = $this->app['config']->get('debugbar.options.logs.file');
337326
$this->addCollector(new LogsCollector($file));
338327
} catch (\Exception $e) {
339328
$this->addException(
@@ -351,7 +340,7 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
351340
try {
352341
$authCollector = new AuthCollector($app['auth']);
353342
$authCollector->setShowName(
354-
$this->app['config']->get('laravel-debugbar::config.options.auth.show_name')
343+
$this->app['config']->get('debugbar.options.auth.show_name')
355344
);
356345
$this->addCollector($authCollector);
357346
} catch (\Exception $e) {
@@ -364,15 +353,15 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
364353
}
365354

366355
$renderer = $this->getJavascriptRenderer();
367-
$renderer->setIncludeVendors($this->app['config']->get('laravel-debugbar::config.include_vendors', true));
368-
$renderer->setBindAjaxHandlerToXHR($app['config']->get('laravel-debugbar::config.capture_ajax', true));
356+
$renderer->setIncludeVendors($this->app['config']->get('debugbar.include_vendors', true));
357+
$renderer->setBindAjaxHandlerToXHR($app['config']->get('debugbar.capture_ajax', true));
369358

370359
$this->booted = true;
371360
}
372361

373362
public function shouldCollect($name, $default = false)
374363
{
375-
return $this->app['config']->get('laravel-debugbar::config.collectors.' . $name, $default);
364+
return $this->app['config']->get('debugbar.collectors.' . $name, $default);
376365
}
377366

378367
/**
@@ -509,7 +498,7 @@ public function modifyResponse($request, $response)
509498
}
510499
} elseif (
511500
($request->isXmlHttpRequest() || $request->wantsJson()) and
512-
$app['config']->get('laravel-debugbar::config.capture_ajax', true)
501+
$app['config']->get('debugbar.capture_ajax', true)
513502
) {
514503
try {
515504
$this->sendDataInHeaders(true);
@@ -527,7 +516,7 @@ public function modifyResponse($request, $response)
527516
} catch (\Exception $e) {
528517
$app['log']->error('Debugbar exception: ' . $e->getMessage());
529518
}
530-
} elseif ($app['config']->get('laravel-debugbar::config.inject', true)) {
519+
} elseif ($app['config']->get('debugbar.inject', true)) {
531520
try {
532521
$this->injectDebugbar($response);
533522
} catch (\Exception $e) {
@@ -547,7 +536,7 @@ public function modifyResponse($request, $response)
547536
*/
548537
public function isEnabled()
549538
{
550-
return value($this->app['config']->get('laravel-debugbar::config.enabled'));
539+
return value($this->app['config']->get('debugbar.enabled'));
551540
}
552541

553542
/**
@@ -635,7 +624,7 @@ public function injectDebugbar(Response $response)
635624
*/
636625
public function disable()
637626
{
638-
$this->app['config']->set('laravel-debugbar::config.enabled', false);
627+
$this->app['config']->set('debugbar.enabled', false);
639628
}
640629

641630
/**
@@ -764,23 +753,23 @@ protected function checkVersion($version, $operator = ">=")
764753
protected function selectStorage(DebugBar $debugbar)
765754
{
766755
$config = $this->app['config'];
767-
if ($config->get('laravel-debugbar::config.storage.enabled')) {
768-
$driver = $config->get('laravel-debugbar::config.storage.driver', 'file');
756+
if ($config->get('debugbar.storage.enabled')) {
757+
$driver = $config->get('debugbar.storage.driver', 'file');
769758

770759
switch ($driver) {
771760
case 'pdo':
772-
$connection = $config->get('laravel-debugbar::config.storage.connection');
761+
$connection = $config->get('debugbar.storage.connection');
773762
$table = $this->app['db']->getTablePrefix() . 'phpdebugbar';
774763
$pdo = $this->app['db']->connection($connection)->getPdo();
775764
$storage = new PdoStorage($pdo, $table);
776765
break;
777766
case 'redis':
778-
$connection = $config->get('laravel-debugbar::config.storage.connection');
767+
$connection = $config->get('debugbar.storage.connection');
779768
$storage = new RedisStorage($this->app['redis']->connection($connection));
780769
break;
781770
case 'file':
782771
default:
783-
$path = $config->get('laravel-debugbar::config.storage.path');
772+
$path = $config->get('debugbar.storage.path');
784773
$storage = new FilesystemStorage($this->app['files'], $path);
785774
break;
786775
}

src/Middleware/Stack.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)