Skip to content

Commit 0bb45aa

Browse files
committed
Initial commit
0 parents  commit 0bb45aa

18 files changed

+578
-0
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
* text=auto
2+
3+
/.github export-ignore
4+
/docs export-ignore
5+
/demo export-ignore
6+
/tests export-ignore
7+
/.gitattributes export-ignore
8+
/.gitignore export-ignore
9+
/phpunit.xml.dist export-ignore
10+
/phpstan* export-ignore
11+
/CHANGELOG.md export-ignore
12+
/CONTRIBUTING.md export-ignore
13+
/README.md export-ignore
14+
/cli-config.php export-ignore
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
jobs:
11+
php-tests:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 15
14+
env:
15+
COMPOSER_NO_INTERACTION: 1
16+
17+
strategy:
18+
matrix:
19+
php: [8.5, 8.4, 8.3, 8.2]
20+
21+
name: PHP${{ matrix.php }}
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
coverage: none
32+
33+
- name: Install dependencies
34+
run: |
35+
composer update --prefer-dist --no-progress
36+
37+
- name: Execute Unit Tests
38+
run: vendor/bin/phpunit --testsuite=Browser
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Screenshots
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
php-tests:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 15
15+
env:
16+
COMPOSER_NO_INTERACTION: 1
17+
18+
strategy:
19+
matrix:
20+
php: [8.4]
21+
22+
name: PHP${{ matrix.php }}
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
coverage: none
33+
34+
- name: Install dependencies
35+
run: |
36+
composer update --prefer-dist --no-progress
37+
38+
- name: Execute Unit Tests
39+
run: vendor/bin/phpunit --testsuite=Browser
40+
41+
- name: Upload screenshots
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: debugbar-screenshots
45+
path: tests/screenshots

.github/workflows/run-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
php-tests:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 15
15+
env:
16+
COMPOSER_NO_INTERACTION: 1
17+
18+
strategy:
19+
matrix:
20+
php: [8.5, 8.4, 8.3, 8.2]
21+
22+
name: PHP${{ matrix.php }}
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
coverage: none
33+
34+
- name: Install dependencies
35+
run: composer update --prefer-dist --no-progress
36+
37+
- name: Execute Unit Tests
38+
run: vendor/bin/phpunit --testsuite=Unit

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/composer.lock
2+
/vendor
3+
/demo/db.sqlite
4+
/.phpunit.result.cache
5+
/drivers/
6+
.phpunit.cache/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 PHP Debugbar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Monolog Bridge for PHP Debug Bar
2+
3+
## Install
4+
5+
This requires https://github.com/php-debugbar/php-debugbar/ to be installed first.
6+
7+
8+
```
9+
composer require php-debugbar/monolog-bridge
10+
```
11+
12+
## Demo
13+
14+
To run the demo, clone this repository and install the dependencies.
15+
16+
```
17+
composer install
18+
```
19+
20+
Then start the Built-In PHP webserver from the root:
21+
22+
```
23+
composer run demo
24+
```
25+
26+
Then visit http://localhost:8000/demo/
27+
28+
## Testing
29+
30+
To test, run `php vendor/bin/phpunit`.
31+
To debug Browser tests, you can run `PANTHER_NO_HEADLESS=1 vendor/bin/phpunit --debug`. Run `vendor/bin/bdi detect drivers` to download the latest drivers.

composer.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "php-debugbar/monolog-bridge",
3+
"description": "Monolog bridge for PHP Debugbar",
4+
"keywords": ["debugbar", "monolog", "dev"],
5+
"homepage": "https://github.com/php-debugbar/php-debugbar",
6+
"type": "library",
7+
"license": "MIT",
8+
"authors": [
9+
{
10+
"name": "Maxime Bouroumeau-Fuseau",
11+
"email": "[email protected]",
12+
"homepage": "http://maximebf.com"
13+
},
14+
{
15+
"name": "Barry vd. Heuvel",
16+
"email": "[email protected]"
17+
}
18+
],
19+
"require": {
20+
"php": "^8.2",
21+
"php-debugbar/php-debugbar": "^3",
22+
"monolog/monolog": "^3"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": "^10",
26+
"symfony/panther": "^1|^2.1",
27+
"dbrekelmans/bdi": "^1.4",
28+
"symfony/dom-crawler": "^6|^7",
29+
"symfony/browser-kit": "^6|^7"
30+
},
31+
"autoload": {
32+
"psr-4": {
33+
"DebugBar\\Bridge\\Monolog\\": "src/"
34+
}
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"DebugBar\\Bridge\\Monolog\\Tests\\": "tests/"
39+
}
40+
},
41+
"scripts": {
42+
"demo": [
43+
"Composer\\Config::disableProcessTimeout",
44+
"@php -S localhost:8000"
45+
],
46+
"unit-test": "@php vendor/bin/phpunit --testsuite=Unit",
47+
"browser-test": "@php vendor/bin/phpunit --testsuite=Browser",
48+
"browser-debug": [
49+
"@putenv PANTHER_NO_HEADLESS=1",
50+
"@php vendor/bin/phpunit --testsuite=Browser --debug"
51+
]
52+
},
53+
"extra": {
54+
"branch-alias": {
55+
"dev-master": "1.0-dev"
56+
}
57+
},
58+
"minimum-stability": "beta"
59+
}

demo/assets.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/** @var \DebugBar\DebugBar $debugbar */
6+
/** @var \DebugBar\JavascriptRenderer $debugbarRenderer */
7+
8+
//Disable session caching
9+
session_cache_limiter('');
10+
11+
include 'bootstrap.php';
12+
13+
$openHandler = new DebugBar\AssetHandler($debugbar);
14+
$openHandler->handle($_GET);

demo/bootstrap.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
include __DIR__ . '/../vendor/autoload.php';
4+
5+
// for stack data
6+
session_start();
7+
8+
use DebugBar\StandardDebugBar;
9+
10+
$debugbar = new StandardDebugBar();
11+
$debugbarRenderer = $debugbar->getJavascriptRenderer()
12+
->setAssetHandlerUrl('assets.php')
13+
->setAjaxHandlerEnableTab(true)
14+
->setHideEmptyTabs(true)
15+
->setCspNonce('demo')
16+
->setTheme($_GET['theme'] ?? 'auto');
17+
18+
//
19+
// create a writable profiles folder in the demo directory to uncomment the following lines
20+
//
21+
// $debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles'));
22+
// $debugbar->setStorage(new DebugBar\Storage\RedisStorage(new Predis\Client()));
23+
// $debugbarRenderer->setOpenHandlerUrl('open.php');
24+
25+
function render_demo_page(?Closure $callback = null)
26+
{
27+
global $debugbarRenderer;
28+
?>
29+
<html>
30+
<head>
31+
<?php echo $debugbarRenderer->renderHead() ?>
32+
</head>
33+
<body>
34+
<h1>DebugBar Demo</h1>
35+
<p>DebugBar at the bottom of the page</p>
36+
<?php if ($callback) $callback(); ?>
37+
<?php
38+
echo $debugbarRenderer->render();
39+
?>
40+
</body>
41+
</html>
42+
<?php
43+
}

0 commit comments

Comments
 (0)