1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00
php-debugbar/README.md

103 lines
3.2 KiB
Markdown
Raw Normal View History

2013-06-13 18:48:23 +08:00
# PHP Debug Bar
2013-06-08 01:32:10 +07:00
2013-08-14 22:35:19 +10:00
[![Latest Stable Version](https://poser.pugx.org/maximebf/debugbar/v/stable.png)](https://packagist.org/packages/maximebf/debugbar) [![Build Status](https://travis-ci.org/maximebf/php-debugbar.png?branch=master)](https://travis-ci.org/maximebf/php-debugbar)
2013-08-14 22:36:03 +10:00
2013-06-13 18:48:23 +08:00
Displays a debug bar in the browser with information from php.
No more `var_dump()` in your code!
2013-06-19 13:15:46 +09:00
![Screenshot](https://raw.github.com/maximebf/php-debugbar/master/docs/screenshot.png)
2013-06-13 18:48:23 +08:00
**Features:**
2013-08-17 12:47:50 +10:00
- Generic debug bar
2013-06-13 18:48:23 +08:00
- Easy to integrate with any project
- Clean, fast and easy to use interface
- Handles AJAX request
- Includes generic data collectors and collectors for well known libraries
- The client side bar is 100% coded in javascript
- Easily create your own collectors and their associated view in the bar
2013-09-05 15:18:55 +02:00
- Save and re-open previous requests
2013-08-13 12:29:40 +10:00
- [Very well documented](http://phpdebugbar.com/docs)
2013-06-13 18:48:23 +08:00
2013-08-13 12:29:40 +10:00
Includes collectors for:
- [PDO](http://php.net/manual/en/book.pdo.php)
- [CacheCache](http://maximebf.github.io/CacheCache/)
- [Doctrine](http://doctrine-project.org)
- [Monolog](https://github.com/Seldaek/monolog)
- [Propel](http://propelorm.org/)
- [Slim](http://slimframework.com)
- [Swift Mailer](http://swiftmailer.org/)
- [Twig](http://twig.sensiolabs.org/)
Checkout the [demo](https://github.com/maximebf/php-debugbar/tree/master/demo) for
examples and [phpdebugbar.com](http://phpdebugbar.com) for a live example.
2013-06-13 18:48:23 +08:00
2013-09-05 15:18:55 +02:00
Integrations with other frameworks:
2013-09-15 19:44:40 +02:00
- [Laravel](https://github.com/barryvdh/laravel-debugbar)
- [Atomik](http://atomikframework.com/docs/error-log-debug.html#debug-bar)
2013-09-15 19:44:40 +02:00
- [XOOPS](http://xoops.org/modules/news/article.php?storyid=6538)
2013-09-05 15:18:55 +02:00
*(drop me a message or submit a PR to add your DebugBar related project here)*
2013-06-13 18:48:23 +08:00
## Installation
2013-08-17 12:47:50 +10:00
The best way to install DebugBar is using [Composer](http://getcomposer.org)
2013-06-13 18:48:23 +08:00
with the following requirement:
```JSON
{
"require": {
"maximebf/debugbar": ">=1.0.0"
2013-06-13 18:48:23 +08:00
}
}
```
2013-06-13 18:48:23 +08:00
2013-08-17 12:47:50 +10:00
If you are cloning the repository, you'll need to run `composer install`.
2013-06-13 18:48:23 +08:00
## Quick start
2013-08-16 00:52:32 +01:00
DebugBar is very easy to use and you can add it to any of your projects in no time.
2013-06-13 18:48:23 +08:00
The easiest way is using the `render()` functions
```PHP
<?php
use DebugBar\StandardDebugBar;
$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();
$debugbar["messages"]->addMessage("hello world!");
?>
<html>
<head>
<?php echo $debugbarRenderer->renderHead() ?>
</head>
<body>
...
<?php echo $debugbarRenderer->render() ?>
</body>
2013-10-25 16:43:00 -04:00
</html>
```
2013-06-13 18:48:23 +08:00
The DebugBar uses DataCollectors to collect data from your PHP code. Some of them are
automated but others are manual. Use the `DebugBar` like an array where keys are the
collector names. In our previous example, we add a message to the `MessagesCollector`:
```PHP
$debugbar["messages"]->addMessage("hello world!");
```
2013-06-13 18:48:23 +08:00
2013-08-13 12:29:40 +10:00
`StandardDebugBar` activates the following collectors:
2013-06-13 18:48:23 +08:00
- `MemoryCollector` (*memory*)
- `MessagesCollector` (*messages*)
- `PhpInfoCollector` (*php*)
- `RequestDataCollector` (*request*)
- `TimeDataCollector` (*time*)
2013-06-19 13:15:46 +09:00
- `ExceptionsCollector` (*exceptions*)
2013-06-13 18:48:23 +08:00
2013-06-20 12:08:50 +09:00
Learn more about DebugBar in the [docs](http://phpdebugbar.com/docs).