Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 501adde

Browse files
committed
Merge branch 'hotfix/265'
Close #265
2 parents b86838f + d6e1e97 commit 501adde

File tree

1 file changed

+9
-37
lines changed

1 file changed

+9
-37
lines changed

doc/book/cookbook/debug-toolbars.md

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -47,65 +47,37 @@ a [post detailing these steps](https://blog.bitexpert.de/blog/using-prophiler-wi
4747
> — and not in production, where you likely do not want to expose such
4848
> information!
4949
50-
## php-middleware/phpdebugbar
50+
## php-middleware/php-debug-bar
5151

52-
[php-middleware/phpdebugbar](https://github.com/php-middleware/phpdebugbar)
52+
[php-middleware/php-debug-bar](https://github.com/php-middleware/phpdebugbar)
5353
provides a PSR-7 middleware wrapper around [maximebf/debugbar](https://github.com/maximebf/debugbar),
5454
a popular framework-agnostic debug bar for PHP projects.
5555

5656
First, install the middleware in your application:
5757

5858
```bash
59-
$ composer require php-middleware/phpdebugbar
59+
$ composer require php-middleware/php-debug-bar
6060
```
6161

62-
DebugBar ships with a number of fonts, CSS files, and JavaScript assets that it
63-
uses. These will need to be copied into your web root:
64-
65-
```bash
66-
$ cp -a vendor/maximebf/debugbar/src/DebugBar/Resources public/phpdebugbar
67-
```
68-
69-
(The above creates a new directory, `public/phpdebugbar/`, containing all of the
70-
assets from the DebugBar package.)
71-
72-
Next, you'll need to create a factory. As an example, you could write the
73-
following class (in `src/App/PhpDebugBarMiddlewareFactory.php`):
62+
This package provides a factory for creating the middleware, so we only need to
63+
wire it into our middleware pipeline. Create and edit the file
64+
`config/autoload/middleware-pipeline.local.php` to read as follows:
7465

7566
```php
76-
<?php
77-
namespace App;
78-
79-
use DebugBar\StandardDebugBar;
8067
use PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware;
68+
use PhpMiddleware\PhpDebugBar\PhpDebugBarMiddlewareFactory;
8169

82-
class PhpDebugBarMiddlewareFactory
83-
{
84-
public function __invoke($container)
85-
{
86-
$debugbar = new StandardDebugBar();
87-
$renderer = $debugbar->getJavascriptRenderer('/phpdebugbar');
88-
return new PhpDebugBarMiddleware($renderer);
89-
}
90-
}
91-
```
92-
93-
Finally, you will need to notify the application of this factory, and add the
94-
middleware to your middleware pipeline. Create and edit the file
95-
`config/autoload/middleware-pipeline.local.php` to read as follows:
96-
97-
```php
9870
return [
9971
'dependencies' => [
10072
'factories' => [
101-
PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware::class => App\PhpDebugBarMiddlewareFactory::class,
73+
PhpDebugBarMiddleware::class => PhpDebugBarMiddlewareFactory::class,
10274
],
10375
],
10476
'middleware_pipeline' => [
10577
'pre_routing' => [
10678
[
10779
'middleware' => [
108-
PhpMiddleware\PhpDebugBar\PhpDebugBarMiddleware::class,
80+
PhpDebugBarMiddleware::class,
10981
],
11082
],
11183
],

0 commit comments

Comments
 (0)