Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
php-version: 8.4

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: composer update --prefer-dist --no-progress

- name: Build all files
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
tools: composer:v2

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: composer update --prefer-dist --no-progress

- name: Run Tests for Docs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
coverage: pcov

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: |
composer update --prefer-dist --no-interaction --no-suggest --with-all-dependencies

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fix-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
tools: composer:v2

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: composer update --prefer-dist --no-progress

- name: Fix Code Style
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
run: composer require "symfony/var-dumper:${{ matrix.symfony }}" --no-interaction --no-update

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: |
composer update --prefer-dist --no-progress

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
extensions: pdo_sqlite

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: |
composer update --prefer-dist --no-progress

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
coverage: none

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress

- name: Analyse with PHPStan
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
run: composer require "symfony/var-dumper:${{ matrix.symfony }}" --no-interaction --no-update

- name: Install dependencies
env:
COMPOSER_ROOT_VERSION: dev-master
run: composer update --prefer-dist --no-progress

- name: Execute Unit Tests
Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@
"psr/log": "^1|^2|^3",
"symfony/var-dumper": "^5.4|^6|^7|^8"
},
"suggest": {
"php-debugbar/doctrine-bridge": "To integrate Doctrine with php-debugbar.",
"php-debugbar/monolog-bridge": "To integrate Monolog with php-debugbar.",
"php-debugbar/symfony-bridge": "To integrate Symfony with php-debugbar.",
"php-debugbar/twig-bridge": "To integrate Twig with php-debugbar."
},
"replace": {
"maximebf/debugbar": "self.version"
},
"require-dev": {
"dbrekelmans/bdi": "^1.4",
"friendsofphp/php-cs-fixer": "^3.92",
"monolog/monolog": "^3.9",
"php-debugbar/doctrine-bridge": "^3@dev",
"php-debugbar/monolog-bridge": "^1@dev",
"php-debugbar/symfony-bridge": "^1@dev",
"php-debugbar/twig-bridge": "^2@dev",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10",
Expand Down
2 changes: 1 addition & 1 deletion demo/collectors/monolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

$logger = new Monolog\Logger('demo');

$debugbar->addCollector(new DebugBar\Bridge\MonologCollector($logger));
$debugbar->addCollector(new DebugBar\Bridge\Monolog\MonologCollector($logger));

$logger->info('hello world');
6 changes: 3 additions & 3 deletions demo/symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use DebugBar\DataCollector\MessagesCollector;
use DebugBar\DataCollector\TimeDataCollector;
use DebugBar\SymfonyHttpDriver;
use DebugBar\Bridge\Symfony\SymfonyHttpDriver;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
Expand Down Expand Up @@ -76,8 +76,8 @@
// Inject Debugbar
if ($ajax) {
$debugbar->sendDataInHeaders();
} else {
$debugbar->getJavascriptRenderer()->injectInSymfonyResponse($response);
} elseif ($response->getContent()) {
$response->setContent($debugbar->getJavascriptRenderer()->injectInHtmlResponse($response->getContent()));
}

// Adds the Content-Security-Policy to the HTTP header.
Expand Down
24 changes: 11 additions & 13 deletions docs/collectors/bridge.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Bridge collectors

DebugBar comes with some "bridge" collectors. These collectors provides a way to integrate other projects with the DebugBar.
DebugBar has a few "bridge" collectors. These collectors provides a way to integrate other projects with the DebugBar.
These usually require additional composer packages.

## Symfony HttpFoundation Request / Response

https://symfony.com/doc/current/components/http_foundation.html

> Requires https://github.com/php-debugbar/symfony-bridge


This extends the [existing RequestDataCollector](base.md#requestdata) for the Symfony HttpFoundation Request and Response.

```php
Expand All @@ -14,16 +18,6 @@ use Symfony\Component\Mailer\Event\SentMessageEvent;
$debugbar->addCollector(new DebugBar\Bridge\Symfony\SymfonyRequestCollector($request, $response));
```

### Inject the debugbar into the Symfony HttpFoundation Response

To inject the debugbar into the Symfony HttpFoundation Response, you can use the JavascriptRenderer:

```php
// Inject Debugbar
$debugbar->getJavascriptRenderer()->injectInSymfonyResponse($response);
```

This will call renderHead() and render() just before the closing </body> tag. You can disable the header by setting false as second parameter.

## Doctrine

Expand All @@ -46,11 +40,13 @@ provided the `SQLLogger` is a ̀DebugStack`.

https://github.com/Seldaek/monolog

> Requires https://github.com/php-debugbar/monolog-bridge

Integrates Monolog messages into a message view using `DebugBar\Bridge\MonologCollector`.

```php
$logger = new Monolog\Logger('mylogger');
$debugbar->addCollector(new DebugBar\Bridge\MonologCollector($logger));
$debugbar->addCollector(new DebugBar\Bridge\Monolog\MonologCollector($logger));
```
Note that multiple logger can be collected:

Expand All @@ -64,6 +60,8 @@ $debugbar['monolog']->addLogger($logger);

https://symfony.com/doc/current/mailer.html

> Requires https://github.com/php-debugbar/symfony-bridge

Display log messages and sent mail using `DebugBar\Bridge\Symfony\SymfonyMailCollector`

```php
Expand Down
9 changes: 7 additions & 2 deletions docs/docs/http-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ and will be used if no other driver are specified.

## Symfony Http Driver

The is also a Symfony Http Driver, which uses the Symfony HttpFoundation Session and Response objects.
> Requires https://github.com/php-debugbar/symfony-bridge

There is also a Symfony Http Driver, which uses the Symfony HttpFoundation Session and Response objects. Install the package above to us this.

```php

use DebugBar\Bridge\Symfony\SymfonyHttpDriver;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;

// Get the Session from the framework, or create a new one
$session = new Session(new PhpBridgeSessionStorage());

$httpDriver = new SymfonyHttpDriver($session);
$debugbar->setHttpDriver($httpDriver);


// Get the Response from your application, before sending it
$response = ..

Expand Down
96 changes: 0 additions & 96 deletions src/Bridge/MonologCollector.php

This file was deleted.

Loading
Loading