Skip to content

Commit c6b409f

Browse files
committed
Create gh-pages branch via GitHub
0 parents  commit c6b409f

File tree

12 files changed

+1392
-0
lines changed

12 files changed

+1392
-0
lines changed

images/body-bg.jpg

2.23 KB
Loading

images/download-button.png

26.5 KB
Loading

images/github-button.png

1.51 KB
Loading

images/header-bg.jpg

9.24 KB
Loading

images/highlight-bg.jpg

30.3 KB
Loading

images/sidebar-bg.jpg

2.22 KB
Loading

index.html

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8'>
5+
<meta http-equiv="X-UA-Compatible" content="chrome=1">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
7+
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
8+
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
9+
<link rel="stylesheet" type="text/css" href="stylesheets/pygment_trac.css" media="screen">
10+
<link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print">
11+
12+
<!--[if lt IE 9]>
13+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
14+
<![endif]-->
15+
16+
<title>Laravel-debugbar by barryvdh</title>
17+
</head>
18+
19+
<body>
20+
<header>
21+
<div class="inner">
22+
<h1>Laravel-debugbar</h1>
23+
<h2>Laravel 4 Debugbar (Integrates PHP Debug Bar)</h2>
24+
<a href="https://github.com/barryvdh/laravel-debugbar" class="button"><small>View project on</small> GitHub</a>
25+
</div>
26+
</header>
27+
28+
<div id="content-wrapper">
29+
<div class="inner clearfix">
30+
<section id="main-content">
31+
<h2>
32+
<a id="laravel-4-debugbar" class="anchor" href="#laravel-4-debugbar" aria-hidden="true"><span class="octicon octicon-link"></span></a>Laravel 4 Debugbar</h2>
33+
34+
<p><a href="http://choosealicense.com/licenses/mit/"><img src="https://poser.pugx.org/barryvdh/laravel-debugbar/license.png" alt="Packagist License"></a>
35+
<a href="https://packagist.org/packages/barryvdh/laravel-debugbar"><img src="https://poser.pugx.org/barryvdh/laravel-debugbar/version.png" alt="Latest Stable Version"></a>
36+
<a href="https://packagist.org/packages/barryvdh/laravel-debugbar"><img src="https://poser.pugx.org/barryvdh/laravel-debugbar/d/total.png" alt="Total Downloads"></a></p>
37+
38+
<p>This is a package to integrate <a href="http://phpdebugbar.com/">PHP Debug Bar</a> with Laravel.
39+
It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.
40+
It bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel.
41+
It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown)
42+
Read <a href="http://phpdebugbar.com/docs/">the documentation</a> for more configuration options.</p>
43+
44+
<p><img src="https://cloud.githubusercontent.com/assets/973269/4270452/740c8c8c-3ccb-11e4-8d9a-5a9e64f19351.png" alt="Screenshot"></p>
45+
46+
<p>Note: Use the DebugBar only in development. It can slow the application down (because it has to gather data). So when experiencing slowness, try disabling some of the collectors.</p>
47+
48+
<p>This package includes some custom collectors:</p>
49+
50+
<ul>
51+
<li>QueryCollector: Show all queries, including binding + timing</li>
52+
<li>RouteCollector: Show information about the current Route.</li>
53+
<li>ViewCollector: Show the currently loaded views. (Optionally: display the shared data)</li>
54+
<li>EventsCollector: Show all events</li>
55+
<li>LaravelCollector: Show the Laravel version and Environment. (disabled by default)</li>
56+
<li>SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response</li>
57+
<li>LogsCollector: Show the latest log entries from the storage logs. (disabled by default)</li>
58+
<li>FilesCollector: Show the files that are included/required by PHP. (disabled by default)</li>
59+
<li>ConfigCollector: Display the values from the config files. (disabled by default)</li>
60+
</ul>
61+
62+
<p>Bootstraps the following collectors for Laravel:</p>
63+
64+
<ul>
65+
<li>LogCollector: Show all Log messages</li>
66+
<li>SwiftMailCollector and SwiftLogCollector for Mail</li>
67+
</ul>
68+
69+
<p>And the default collectors:</p>
70+
71+
<ul>
72+
<li>PhpInfoCollector</li>
73+
<li>MessagesCollector</li>
74+
<li>TimeDataCollector (With Booting and Application timing)</li>
75+
<li>MemoryCollector</li>
76+
<li>ExceptionsCollector</li>
77+
</ul>
78+
79+
<p>It also provides a Facade interface for easy logging Messages, Exceptions and Time</p>
80+
81+
<h2>
82+
<a id="installation" class="anchor" href="#installation" aria-hidden="true"><span class="octicon octicon-link"></span></a>Installation</h2>
83+
84+
<p>Require this package with composer:</p>
85+
86+
<pre><code>composer require barryvdh/laravel-debugbar
87+
</code></pre>
88+
89+
<p>After updating composer, add the ServiceProvider to the providers array in app/config/app.php</p>
90+
91+
<pre><code>'Barryvdh\Debugbar\ServiceProvider',
92+
</code></pre>
93+
94+
<p>If you want to use the facade to log messages, add this to your facades in app.php:</p>
95+
96+
<pre><code>'Debugbar' =&gt; 'Barryvdh\Debugbar\Facade',
97+
</code></pre>
98+
99+
<p><del>You need to publish the assets from this package.</del> Since 1.7, you don't need to publish the assets anymore.</p>
100+
101+
<p>The profiler is enabled by default, if you have app.debug=true. You can override that in the config files.
102+
You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.
103+
You can also only display the js of css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to <code>true</code> for syntax highlighting)</p>
104+
105+
<pre><code>php artisan config:publish barryvdh/laravel-debugbar
106+
</code></pre>
107+
108+
<p>You can also disable/enable the loggers you want. You can also use the IoC container to add extra loggers. (<code>$app['debugbar']-&gt;addCollector(new MyDataCollector)</code>)</p>
109+
110+
<p>You can now add messages using the Facade (when added), using the PSR-3 levels (debug, info, notice, warning, error, critical, alert, emergency):</p>
111+
112+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>info(<span class="pl-v"><span class="pl-pdv">$</span>object</span>);</span>
113+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>error(<span class="pl-s1"><span class="pl-pds">'</span>Error!<span class="pl-pds">'</span></span>);</span>
114+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>warning(<span class="pl-s1"><span class="pl-pds">'</span>Watch out…<span class="pl-pds">'</span></span>);</span>
115+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>addMessage(<span class="pl-s1"><span class="pl-pds">'</span>Another message<span class="pl-pds">'</span></span>, <span class="pl-s1"><span class="pl-pds">'</span>mylabel<span class="pl-pds">'</span></span>);</span></pre></div>
116+
117+
<p>And start/stop timing:</p>
118+
119+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>startMeasure(<span class="pl-s1"><span class="pl-pds">'</span>render<span class="pl-pds">'</span></span>,<span class="pl-s1"><span class="pl-pds">'</span>Time for rendering<span class="pl-pds">'</span></span>);</span>
120+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>stopMeasure(<span class="pl-s1"><span class="pl-pds">'</span>render<span class="pl-pds">'</span></span>);</span>
121+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>addMeasure(<span class="pl-s1"><span class="pl-pds">'</span>now<span class="pl-pds">'</span></span>, <span class="pl-c1">LARAVEL_START</span>, <span class="pl-sf">microtime</span>(<span class="pl-c1">true</span>));</span>
122+
<span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>measure(<span class="pl-s1"><span class="pl-pds">'</span>My long operation<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>() {</span>
123+
<span class="pl-s2"> <span class="pl-c"><span class="pl-pdc">//</span> Do something…</span></span>
124+
<span class="pl-s2">});</span></pre></div>
125+
126+
<p>Or log exceptions:</p>
127+
128+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-k">try</span> {</span>
129+
<span class="pl-s2"> <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-sc">Exception</span>(<span class="pl-s1"><span class="pl-pds">'</span>foobar<span class="pl-pds">'</span></span>);</span>
130+
<span class="pl-s2">} <span class="pl-k">catch</span> (<span class="pl-sc">Exception</span> <span class="pl-v"><span class="pl-pdv">$</span>e</span>) {</span>
131+
<span class="pl-s2"> <span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>addException(<span class="pl-v"><span class="pl-pdv">$</span>e</span>);</span>
132+
<span class="pl-s2">}</span></pre></div>
133+
134+
<p>There are also helper functions available for the most common calls:</p>
135+
136+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-c"><span class="pl-pdc">//</span> All arguments will be dumped as a debug message</span></span>
137+
<span class="pl-s2">debug(<span class="pl-v"><span class="pl-pdv">$</span>var1</span>, <span class="pl-v"><span class="pl-pdv">$</span>someString</span>, <span class="pl-v"><span class="pl-pdv">$</span>intValue</span>, <span class="pl-v"><span class="pl-pdv">$</span>object</span>);</span>
138+
<span class="pl-s2"></span>
139+
<span class="pl-s2">start_measure(<span class="pl-s1"><span class="pl-pds">'</span>render<span class="pl-pds">'</span></span>,<span class="pl-s1"><span class="pl-pds">'</span>Time for rendering<span class="pl-pds">'</span></span>);</span>
140+
<span class="pl-s2">stop_measure(<span class="pl-s1"><span class="pl-pds">'</span>render<span class="pl-pds">'</span></span>);</span>
141+
<span class="pl-s2">add_measure(<span class="pl-s1"><span class="pl-pds">'</span>now<span class="pl-pds">'</span></span>, <span class="pl-c1">LARAVEL_START</span>, <span class="pl-sf">microtime</span>(<span class="pl-c1">true</span>));</span>
142+
<span class="pl-s2">measure(<span class="pl-s1"><span class="pl-pds">'</span>My long operation<span class="pl-pds">'</span></span>, <span class="pl-s">function</span>() {</span>
143+
<span class="pl-s2"> <span class="pl-c"><span class="pl-pdc">//</span> Do something…</span></span>
144+
<span class="pl-s2">});</span></pre></div>
145+
146+
<p>If you want you can add your own DataCollectors, through the Container or the Facade:</p>
147+
148+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>addCollector(<span class="pl-k">new</span> DebugBar\DataCollector\<span class="pl-sc">MessagesCollector</span>(<span class="pl-s1"><span class="pl-pds">'</span>my_messages<span class="pl-pds">'</span></span>));</span>
149+
<span class="pl-s2"><span class="pl-c"><span class="pl-pdc">//</span>Or via the App container:</span></span>
150+
<span class="pl-s2"><span class="pl-v"><span class="pl-pdv">$</span>debugbar</span> <span class="pl-ko">=</span> <span class="pl-sc">App</span><span class="pl-ko">::</span>make(<span class="pl-s1"><span class="pl-pds">'</span>debugbar<span class="pl-pds">'</span></span>);</span>
151+
<span class="pl-s2"><span class="pl-v"><span class="pl-pdv">$</span>debugbar</span><span class="pl-ko">-&gt;</span>addCollector(<span class="pl-k">new</span> DebugBar\DataCollector\<span class="pl-sc">MessagesCollector</span>(<span class="pl-s1"><span class="pl-pds">'</span>my_messages<span class="pl-pds">'</span></span>));</span></pre></div>
152+
153+
<p>By default, the Debugbar is injected just before <code>&lt;/body&gt;</code>. If you want to inject the Debugbar yourself,
154+
set the config option 'inject' to false and use the renderer yourself and follow <a href="http://phpdebugbar.com/docs/rendering.html">http://phpdebugbar.com/docs/rendering.html</a></p>
155+
156+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-v"><span class="pl-pdv">$</span>renderer</span> <span class="pl-ko">=</span> <span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>getJavascriptRenderer();</span></pre></div>
157+
158+
<p>Note: Not using the auto-inject, will disable the Request information, because that is added After the response.
159+
You can add the default_request datacollector in the config as alternative.</p>
160+
161+
<h2>
162+
<a id="enablingdisabling-on-run-time" class="anchor" href="#enablingdisabling-on-run-time" aria-hidden="true"><span class="octicon octicon-link"></span></a>Enabling/Disabling on run time</h2>
163+
164+
<p>You can enable or disable the debugbar during run time.</p>
165+
166+
<div class="highlight highlight-php"><pre><span class="pl-s2">\<span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>enable();</span>
167+
<span class="pl-s2">\<span class="pl-sc">Debugbar</span><span class="pl-ko">::</span>disable();</span></pre></div>
168+
169+
<p>NB. Once enabled, the collectors are added (and could produce extra overhead), so if you want to use the debugbar in production, disable in the config and only enable when needed.</p>
170+
171+
<h2>
172+
<a id="twig-integration" class="anchor" href="#twig-integration" aria-hidden="true"><span class="octicon octicon-link"></span></a>Twig Integration</h2>
173+
174+
<p>Laravel Debugbar comes with two Twig Extensions. These are tested with <a href="https://github.com/rcrowe/TwigBridge">rcrowe/TwigBridge</a> 0.6.x</p>
175+
176+
<p>Add the following extensions to your TwigBridge config/extensions.php (or register the extensions manually)</p>
177+
178+
<div class="highlight highlight-php"><pre><span class="pl-s2"><span class="pl-s1"><span class="pl-pds">'</span>Barryvdh\Debugbar\Twig\Extension\Debug<span class="pl-pds">'</span></span>,</span>
179+
<span class="pl-s2"><span class="pl-s1"><span class="pl-pds">'</span>Barryvdh\Debugbar\Twig\Extension\Dump<span class="pl-pds">'</span></span>,</span>
180+
<span class="pl-s2"><span class="pl-s1"><span class="pl-pds">'</span>Barryvdh\Debugbar\Twig\Extension\Stopwatch<span class="pl-pds">'</span></span>,</span></pre></div>
181+
182+
<p>The Dump extension will replace the <a href="http://twig.sensiolabs.org/doc/functions/dump.html">dump function</a> to output variables using the DataFormatter. The Debug extension adds a <code>debug()</code> function which passes variables to the Message Collector,
183+
instead of showing it directly in the template. It dumps the arguments, or when empty; all context variables.</p>
184+
185+
<pre><code>{{ debug() }}
186+
{{ debug(user, categories) }}
187+
</code></pre>
188+
189+
<p>The Stopwatch extension adds a <a href="http://symfony.com/blog/new-in-symfony-2-4-a-stopwatch-tag-for-twig">stopwatch tag</a> similar to the one in Symfony/Silex Twigbridge.</p>
190+
191+
<pre><code>{% stopwatch "foo" %}
192+
…some things that gets timed
193+
{% endstopwatch %}
194+
</code></pre>
195+
</section>
196+
197+
<aside id="sidebar">
198+
<a href="https://github.com/barryvdh/laravel-debugbar/zipball/master" class="button">
199+
<small>Download</small>
200+
.zip file
201+
</a>
202+
<a href="https://github.com/barryvdh/laravel-debugbar/tarball/master" class="button">
203+
<small>Download</small>
204+
.tar.gz file
205+
</a>
206+
207+
<p class="repo-owner"><a href="https://github.com/barryvdh/laravel-debugbar"></a> is maintained by <a href="https://github.com/barryvdh">barryvdh</a>.</p>
208+
209+
<p>This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the Architect theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.</p>
210+
</aside>
211+
</div>
212+
</div>
213+
214+
215+
</body>
216+
</html>

javascripts/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('This would be the main JS file.');

0 commit comments

Comments
 (0)