このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン 両方とも次のリビジョン | ||
basic-library:php-debugbar:1.16 [2020/03/19 14:12] tanaka [結果] |
basic-library:php-debugbar:1.16 [2020/03/24 14:20] tanaka [インストール] |
||
---|---|---|---|
行 1: | 行 1: | ||
====== デバッグ出力 - php-debugbar ====== | ====== デバッグ出力 - php-debugbar ====== | ||
- | Version 1.16 | + | Version 1.16 ([[https:// |
--- // | --- // | ||
行 7: | 行 7: | ||
関連記事 | 関連記事 | ||
- | * [[basic-library: | + | * [[basic-library: |
* [[basic-library: | * [[basic-library: | ||
* [[basic-library: | * [[basic-library: | ||
* [[basic-library: | * [[basic-library: | ||
* [[basic-library: | * [[basic-library: | ||
- | * [[basic-library: | + | * [[basic-library: |
- | * [[basic-library: | + | * [[basic-library: |
* デバッグ出力 - php-debugbar | * デバッグ出力 - php-debugbar | ||
- | サイト | + | リンク |
- | * https:// | + | * https:// |
+ | * http:// | ||
+ | テストプログラムの所在 | ||
+ | < | ||
+ | {Project Folder}\test\ | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | ===== php-debugbarについて ===== | ||
+ | |||
+ | エラーログと共にデバッグログ(デバッグライト)はプログラム開発では無くてはならない存在です。[[https:// | ||
+ | |||
+ | php-debugbarは、ブラウザにデバッグバーを表示し、PHPでデバッグ出力した情報を画面に綺麗に整形して表示してくれます。Whoops と同様に本当に pretty cool な存在です。whoops と php-debugbar はPHPデバッグ環境の最強バディと言ってもいいでしょう。 | ||
+ | |||
+ | DebugBarには、ブリッジコレクターと呼ばれる他のパッケージとの統合方法が提供されており、ORMの[[https:// | ||
===== インストール ===== | ===== インストール ===== | ||
< | < | ||
- | D:\>cd usr\workspace3\y2sunlight\apple | + | composer require maximebf/ |
- | D: | + | |
</ | </ | ||
行 43: | 行 57: | ||
Generating autoload files | Generating autoload files | ||
1 package you are using is looking for funding. | 1 package you are using is looking for funding. | ||
- | Use the composer fund command to find out more! | + | Use the `composer fund` command to find out more! |
</ | </ | ||
+ | >Note: | ||
+ | > | ||
+ | |||
+ | パッケージの取得が終わると '' | ||
+ | |||
+ | <code javascript composer.json> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | \\ | ||
===== テスト ===== | ===== テスト ===== | ||
+ | |||
+ | パッケージのテストフォルダ('' | ||
<code php / | <code php / | ||
行 54: | 行 84: | ||
use DebugBar\StandardDebugBar; | use DebugBar\StandardDebugBar; | ||
+ | // デバッグモード有効 | ||
+ | const DEBUG_MODE = true; | ||
+ | |||
+ | // 標準のデバッグレンダラー(StandardDebugBar)の作成 | ||
+ | // (DebugBar/ | ||
$debugbar = new StandardDebugBar(); | $debugbar = new StandardDebugBar(); | ||
$base_url = ' | $base_url = ' | ||
$debugbarRenderer = $debugbar-> | $debugbarRenderer = $debugbar-> | ||
+ | // デバッグライトはメッセージコレクターに出力する | ||
+ | // 使い方はvar_dump($var)と同じ | ||
$arr = [' | $arr = [' | ||
$debugbar[' | $debugbar[' | ||
+ | // PSR-3 logger互換のログ出力 | ||
$debugbar[' | $debugbar[' | ||
+ | $debugbar[' | ||
$debugbar[' | $debugbar[' | ||
$debugbar[' | $debugbar[' | ||
- | |||
?> | ?> | ||
< | < | ||
< | < | ||
- | <?php echo $debugbarRenderer-> | + | |
+ | | ||
</ | </ | ||
< | < | ||
... | ... | ||
- | <?php echo $debugbarRenderer-> | + | |
+ | | ||
</ | </ | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | === 実行結果 === | ||
+ | |||
+ | [{{basic-library: | ||
+ | |||
+ | ■ 標準のデバッグレンダラーでは以下の表示ができます | ||
+ | * php ---PHP バージョン番号 | ||
+ | * memory --- メモリ使用量 | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | ■ デバッグ出力の種類毎にフィルタリングできます。 \\ | ||
+ | ■ メッセージをクリックすると変数の展開できます。 | ||
+ | |||
+ | |||