Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from maxromanovsky/composer

Composer support added + minor UI improvements
  • Loading branch information...
commit 886edda432e404724e942298831dd4e75d4d266e 2 parents 964773f + 977f5d0
Johannes Schlüter authored
25 LICENSE
View
@@ -0,0 +1,25 @@
+Copyright (c) 2012, Johannes Schlüter <johannes@schlueters.de>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name JSMysqlndBundle nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 README.markdown
View
@@ -9,9 +9,9 @@ Requirements
-----------
For making use of this bundle you need Symfony2 running on a PHP setup
-where the mysqli extension is activated and mysqlnd is being used. The mysqli
-extension is only used to retrieve data. It is no requirement for your
-application to use to use mysqli. Applications using Doctrine and PDO are
+where the mysqli extension is activated and mysqlnd is being used. The mysqli
+extension is only used to retrieve data. It is no requirement for your
+application to use to use mysqli. Applications using Doctrine and PDO are
fully supported.
Installation
@@ -19,7 +19,7 @@ Installation
Installation is a quick process:
-1. Download JSMysqlndBundle
+1. Download JSMysqlndBundle or install it via Composer
2. Configure the Autoloader
3. Enable the Bundle
@@ -29,10 +29,17 @@ Ultimately, the JSMysqlndBundle files should be downloaded to the
`vendor/bundles/JS/MysqlndBundle` directory.
This can be done in several ways, depending on your preference. The first
-method is the standard Symfony2 method.
+method is the standard method for Symfony 2.1+.
+
+**Using Composer**
+
+``` bash
+$ php composer.phar require "js/mysqlnd-bundle=dev-master"
+```
**Using the vendors script**
+This method is the standard method for Symfony 2.0
Add the following lines in your `deps` file:
```
@@ -58,6 +65,8 @@ $ git submodule update --init
### Step 2: Configure the Autoloader
+This step should be omitted if you used Composer to install this Bundle.
+
Add the `JS` namespace to your autoloader:
``` php
@@ -87,7 +96,7 @@ public function registerBundles()
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
// ...
- $bundles[] = new JS/MysqlndBundle();
+ $bundles[] = new \JS\MysqlndBundle\JSMysqlndBundle();
}
}
```
44 Resources/views/Collector/mysqlnd.html.twig
View
@@ -26,9 +26,17 @@
{% if collector.statistics %}
<table>
- {% for key, value in collector.statistics %}
- <tr><td>{{ key }}</td><td>{{ value }}</td></tr>
- {% endfor %}
+ <thead>
+ <tr>
+ <th scope="col">Key</th>
+ <th scope="col">Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for key, value in collector.statistics %}
+ <tr><th>{{ key }}</th><td>{{ value }}</td></tr>
+ {% endfor %}
+ </tbody>
</table>
<p>Documentation on the individual statistics can be found on <a href="http://php.net/mysqlnd.stats">http://php.net/mysqlnd.stats</a>.</p>
{% else %}
@@ -40,24 +48,28 @@
<div id="JSMysqlndQC">
<h2>mysqlnd_qc Query Tracing</h2>
-
+
{% if collector.MysqlndQCTrace %}
<table>
- <tr><td>No.</td><td>Run time</td><td>Store Time</td><td>Cachable</td></tr>
- {% for key, value in collector.MysqlndQCTrace %}
- <tr><td colspan="5"><strong>{{ value['query'] }}</strong></td></tr>
- <tr><td>#{{ key+1 }}</td>
- <td>{{ value['run_time'] }} ms</td>
- <td>{{ value['store_time'] }} ms</td>
- <td>{% if value['eligible_for_caching'] %}Cachable{% else %}Not cachable{% endif %}</td>
- <td><a href="#" onclick="document.getElementById('JSMysqlndQCStacktrace{{ key+1 }}').style.display='inline'; return false;">Stacktrace</a></td>
- </tr>
- <tr><td colspan="5" style="overflow: scroll"><pre id="JSMysqlndQCStacktrace{{ key+1 }}" style="display:none;">{{ value['origin'] }}</pre></td></tr>
- {% endfor %}
+ <thead>
+ <tr><th>No.</th><th>Run time</th><th>Store Time</th><th>Cachable</th></tr>
+ </thead>
+ <tbody>
+ {% for key, value in collector.MysqlndQCTrace %}
+ <tr><td colspan="5"><strong>{{ value['query'] }}</strong></td></tr>
+ <tr><th>#{{ key+1 }}</th>
+ <td>{{ value['run_time'] }} ms</td>
+ <td>{{ value['store_time'] }} ms</td>
+ <td>{% if value['eligible_for_caching'] %}Cachable{% else %}Not cachable{% endif %}</td>
+ <td><a href="#" onclick="document.getElementById('JSMysqlndQCStacktrace{{ key+1 }}').style.display='inline'; return false;">Stacktrace</a></td>
+ </tr>
+ <tr><td colspan="5" style="overflow: scroll"><pre id="JSMysqlndQCStacktrace{{ key+1 }}" style="display:none;">{{ value['origin'] }}</pre></td></tr>
+ {% endfor %}
+ </tbody>
</table>
{% else %}
<strong>No myslqnd_qc traces collected for this request.</strong>
<p>For collecting trace data PHP requires the <a href="http://php.net/mysqlnd_qc">mysqlnd_qc extension</a> and <i>mysqlnd_qc.collect_query_trace</i> has to be enabled in php.ini.</p>
{% endif %}
- </div>
+ </div>
{% endblock %}
38 composer.json
View
@@ -0,0 +1,38 @@
+{
+ "name": "js/mysqlnd-bundle",
+ "type": "symfony-bundle",
+ "description": "The JSMysqlndBundle is an extension to the Symfony2 profiling toolbar. It extends the data collection with information gathered from PHP's mysqlnd database driver, giving more insight on the performance.",
+ "keywords": ["database", "mysql", "mysqlnd", "profiler"],
+ "homepage": "https://github.com/johannes/JSMysqlndBundle",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Johannes Schlüter",
+ "homepage": "http://schlueters.de"
+ },
+ {
+ "name": "Max Romanovsky",
+ "homepage": "http://maxromanovsky.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://github.com/johannes/JSMysqlndBundle/contributors"
+ }
+ ],
+ "minimum-stability": "dev",
+ "require": {
+ "php": ">=5.3.2",
+ "ext-mysqli": "*",
+ "ext-mysqlnd": "*",
+ "symfony/framework-bundle": ">=2.0,<2.3-dev"
+ },
+ "suggest": {
+ "ext-mysqlnd_qc": "Required for Query Tracing"
+ },
+ "autoload": {
+ "psr-0": {
+ "JS\\MysqlndBundle": ""
+ }
+ },
+ "target-dir": "JS/MysqlndBundle"
+}
Please sign in to comment.
Something went wrong with that request. Please try again.