PHPackages                             ryunosuke/php-web-debugger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. ryunosuke/php-web-debugger

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

ryunosuke/php-web-debugger
==========================

web debugging tool

v2.0.5(3mo ago)0388[1 PRs](https://github.com/arima-ryunosuke/php-web-debugger/pulls)MITPHPPHP &gt;=8.0.2CI failing

Since Aug 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/arima-ryunosuke/php-web-debugger)[ Packagist](https://packagist.org/packages/ryunosuke/php-web-debugger)[ RSS](/packages/ryunosuke-php-web-debugger/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (4)Versions (48)Used By (0)

WebDebugger
===========

[](#webdebugger)

Description
-----------

[](#description)

フレームワークに依存せず、リクエスト中の各種情報を収集します。 要するに php-debugbar みたいなやつです。

主な機能は下記です。

- iframe で埋め込まれるので本来の画面を汚さない
- Error/Exception の表示
- Request(GET/POST/COOKIE/FILES/SESSION) の表示・編集
- Database のクエリ履歴
- Ajax 履歴
- 実行時間とピークメモリ・タイムライン
- 任意ログ出力機能
- PRG パターン時のリダイレクト抑止
- ファイルパスの関連付け実行

ScreenShot
----------

[](#screenshot)

- [![ScreenShot](ss-Database.png)](ss-Database.png)
- [![ScreenShot](ss-Performance.png)](ss-Performance.png)

Install
-------

[](#install)

```
{
    "require": {
        "ryunosuke/php-web-debugger": "dev-master"
    }
}
```

Usage
-----

[](#usage)

下記を「リクエスト時に必ず通る箇所」に記述するだけです。 共通 include や フレームワークの Bootstrap などがいいでしょう。

このライブラリは Web に特化しているので 共通 include の場合は Web 以外の時に読み込まれるときに注意しましょう（とは言えあまり実害はないはずです）。 レスポンスをフックする処理があるので、リクエストの最後の方ではなく最初の方に記述するのが無難です。

オプションは省略してもそれなりに動きますが、細かな設定を行いたい場合は引数で指定してください。 詳細はソースを参考にしてください。

```
$debugger = new \ryunosuke\WebDebugger\Debugger([
    /** ひっかけるレスポンスヘッダー */
    'rewrite'      => [
        'content-type 正規表現' => fn($contents) => "書き換えたコンテンツ",
    ],
    /** bool PRG パターンの抑止フラグ */
    'stopprg'      => true,
    /** string ひっかけるパス */
    'hookpath'     => 'webdebugger-action',
    /** string 無視するパス */
    'ignore'       => '#\.(ico|map)$#',
    /** string リクエストファイル置き場 */
    'workdir'      => sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'wd-working',
    /** string パスを開く URL */
    'opener'       => 'http://localhost:9090',
    'opener_query' => 'project=X&remote=true',
]);
$debugger->initialize([
    \ryunosuke\WebDebugger\Module\Ajax::class        => [/* 固有のモジュールオプション */],
    \ryunosuke\WebDebugger\Module\Error::class       => [/* 固有のモジュールオプション */],
    \ryunosuke\WebDebugger\Module\Server::class      => [/* 固有のモジュールオプション */],
    \ryunosuke\WebDebugger\Module\Performance::class => [/* 固有のモジュールオプション */],
    \ryunosuke\WebDebugger\Module\Log::class         => [/* 固有のモジュールオプション */],
])->start();
```

Database の Master/Slave など、同じモジュールを複数の設定で使いたい場合は下記のようにします。

```
$debugger->initialize([
    \ryunosuke\WebDebugger\Module\Doctrine::getInstance('Master')->initialize(['connection' => $masterConnection]),
    \ryunosuke\WebDebugger\Module\Doctrine::getInstance('Slave')->initialize(['connection' => $slaveConnection]),
])->start();
```

要するに初期化済みインスタンスの配列を渡すだけです。

まとめると初期化の方法は下記の2通りです。

- `クラス名 => オプション` 形式で渡す
- 初期化済みモジュールインスタンスを渡す

なお、上記は混在化です。

### module

[](#module)

上記のような各種情報を集めるクラスを「モジュール」と呼びます。 モジュールは AbstractModule さえ継承していれば任意に実装・追加が可能です。

### rewrite

[](#rewrite)

`rewrite` について補足すると、前提として body にデバッグ用 html/js/css を差し込んで表示しているため、content-type が text/html でないとアイコン群が表示されません。 例えば JSON な WebAPI や Ajax 処理を作ったとして、その URL を直に叩いてもデバッガは表示されません。

このオプションを指定するとマッチした Content-Type のときに強制的に text/html とみなし、コンテンツも html に書き換えます。 視認性のため、元のコンテンツは整形表示され、pre として埋め込まれます。

それなりにアグレッシブな挙動であり、本来と異なる結果になりうることもあるため、なにかおかしな点があったら無効にして様子を見てみてください。

### opener

[](#opener)

`opener` について補足すると、エラーログのトレースやログの呼び出し箇所など、各モジュールでは随所に「ファイルパス：行番号」という情報が埋め込まれます。 `opener` を設定しておくと、画面クリック時にその URL に file, line パラメータ付きでリクエストを飛ばせます。 `opener_query` も設定しておくとクエリパラメータも一緒に飛びます。

飛び先で file, line に基づいて phpstorm などで指定ファイル・行番号を開くように設定しておけばそのファイルをその行番号で開くようにできます。 要するに IDE ジャンプを http で模したものです。

`bin` ディレクトリにリファレンス実装があります。

License
-------

[](#license)

MIT

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance79

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~40 days

Total

46

Last Release

118d ago

Major Versions

v1.2.11 → v2.0.12024-05-08

v1.2.12 → v2.0.22025-03-23

v1.2.13 → v2.0.32025-06-01

v1.2.14 → v2.0.42025-06-14

v1.3.4 → v2.0.52026-01-19

PHP version history (4 changes)v1.0.3PHP &gt;=7.2

v1.0.12PHP &gt;=7.4

v2.0.0PHP &gt;=8.0

v1.3.0PHP &gt;=8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/e51e177034dd7673cfaa86a43d5236ed7a6bc94f32d05c9100b039d908cd1174?d=identicon)[arima-ryunosuke](/maintainers/arima-ryunosuke)

---

Top Contributors

[![arima-ryunosuke](https://avatars.githubusercontent.com/u/7457522?v=4)](https://github.com/arima-ryunosuke "arima-ryunosuke (191 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ryunosuke-php-web-debugger/health.svg)

```
[![Health](https://phpackages.com/badges/ryunosuke-php-web-debugger/health.svg)](https://phpackages.com/packages/ryunosuke-php-web-debugger)
```

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
