Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 85 | All time: 10,033 This week: 673 |
Version | License | PHP version | Categories | |||
atk4-phpdebugbar 1.0.0 | MIT/X Consortium ... | 7 | Debug, Libraries, PHP 7 |
Collaborate with this project | Author | |||
atk4-phpdebugbar - github.com Description This package can be used to output debug information using PHP DebugBar. Innovation Award
|
<?php |
ATK4 With PHPDebugBar
install via composer :
composer require abbadon1334/atk4-phpdebugbar
add to atk4\ui\App, just after initLayout :
$debugBar = $app->add(
new ATK4PHPDebugBar\DebugBar()
)
PHPDebugBar needs to load his own assets (JS and CSS), you need to set the correct relative url :
$debugBar->setAssetsResourcesUrl('http://localhost/test');
/*
this will load :
#CSS
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/styles/github.css
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.css
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.css
#JS
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/highlight.pack.js
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.js
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.js
- http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.js
*/
the asset url is composed by 3 parts : relative,
example : http://localhost/test/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
resource url and resource path can be defined with methods :
- setAssetsResourcesUrl(string $url)
- setAssetsResourcesPath(string $path)
Example if you use routing :
you have to define a route that serve PHPDebugBar assets :
$debugBar->setAssetsResourcesUrl('/');
$debugBar->setAssetsResourcesPath('debugbar/');
/*
this will load :
- /debugbar/vendor/font-awesome/css/font-awesome.min.css
- /debugbar/openhandler.js
*/
For general documentation, look in the really complete documentation of phpdebugbar : http://phpdebugbar.com/docs/data-collectors.html#using-collectors
Add default collectors :
`$debugbar->addDefaultCollectors()`
OR
`$debugbar->addCollector(DebugBar\DataCollector\DataCollectorInterface $collector)`
if there is an already defined LoggerInterface in the app it will act as a proxy.
add it in this way : $debugBar->addATK4LoggerCollector()
To interact with the logger :
- if your App implements DebugTrait
any calls to LoggerInterface
methods
example : `$app->info('test msg')`
- if your App implements or not DebugTrait
, you can call it this way : $app->getDebugBarCollector('atk4-logger')->info('test');
or any other LoggerInterface methods
- added in this way $debugBar->addATK4PersistenceSQLCollector();
, it will add logging to $this->app->db ( $app->db must exists ).
- added in this way $debugBar->addATK4PersistenceSQLCollector($persistence);
, it will add logging to $persistence that must be instance of Persistence\SQL.
No interaction excepted, just add logs to PHPDebugBar of every call to PDO made by Persistence\SQL
on Init, ATK4PHPDebugBar will add 3 dynamic methods to AppScope :
- getDebugBar() : \DebugBar\DebugBar
return object `\DebugBar\DebugBar`
- getDebugBarCollector($collector_name) : DebugBar\DataCollector\DataCollectorInterface
shorthand to `\DebugBar\DebugBar::getCollector`
- hasDebugBarCollector($collector_name) : bool;
shorthand to `\DebugBar\DebugBar::hasCollector`
Add Unit Test and more examples
Files (20) |
File | Role | Description | ||
---|---|---|---|---|
demos (5 files) | ||||
src (1 file, 1 directory) | ||||
tests (2 files) | ||||
.codeclimate.yml | Data | Auxiliary data | ||
.coveralls.yml | Data | Auxiliary data | ||
.phpmetrics.json | Data | Auxiliary data | ||
.php_cs.dist | Example | Example script | ||
.styleci.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
renovate.json | Data | Auxiliary data |
Files (20) | / | demos |
File | Role | Description |
---|---|---|
bootstrap.php | Aux. | Auxiliary script |
example-logger-debugTrait.php | Class | Class source |
example-logger.php | Example | Example script |
example-persistence.php | Class | Class source |
example.php | Example | Example script |
Files (20) | / | tests |
File | Role | Description |
---|---|---|
DebugBarTest.php | Class | Class source |
DemosTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.