A Symfony 2 bundle to add an API Profiler to the debug toolbar

1.0.1 2013-11-22 04:35 UTC


This bundle adds a REST API profiler/debugger to the Symfony 2 Profiler

Continuous Integration

Build Status Scrutinizer Quality Score Code Coverage


Installation by Composer

Add ApiProfilerBundle bundle as a dependency to the composer.json of your application

"require": {
    "chrisjohnson00/api-profiler-bundle": "dev-master"

Or on the command line with composer require chrisjohnson00/api-profiler-bundle

Add ApiProfilerBundle to your application kernel.

// app/AppKernel.php
    // ...
    public function registerBundles()
        $bundles = array(
            // ...
            new ChrisJohnson00\ApiProfilerBundle\ChrisJohnson00ApiProfilerBundle(),


To change the default warning & error thresholds (used for coloring in the toolbar), you can add these configs. Note: these configs are completely optional!


    # Changes the warning threshold time (ms).  This is used to change the toolbar to yellow when the total response time is > this value
    warning_threshold:    5000 # Example: 5000

    # Changes the error threshold time (ms).  This is used to change the toolbar to red when the total response time is > this value
    error_threshold:      10000 # Example: 10000


A service will be registered by the name of data_collector.api_request. To have API request information included in the profiler, you must attach the profile data using the service.


Here's the full signature:

public function attachData( $url,
                            $requestHeaders = array(),
                            $requestBody = null,
                            $responseHeaders = array(),
                            $responseBody = null)

Here's a simple example:

                        array('User-Agent'=>'My fancy application'),
                        array('Date'=>'Mon, 07 Oct 2013 00:50:46 GMT','Server'=>'Apache'),
                        "Everything is groovy!!");