Developed with love by KnpLabs Hire us for your project!
46

ProfilerLiveBundle

by dsyph3r

Symfony2 Realtime Web Profiler

ProfilerLiveBundle

Overview

Provides a realtime interface for the Symfony2 WebProfilerBundle. Requests
and responses can be viewed in realtime while navigating through a Symfony2 application.
Important information is displayed with each profile including request URL,
response status code, any exception details, doctrine information, memory usage
and more.

profiler_live_bundle

Features

  • See realtime requests/responses from your Symfony2 application including:
    • Memory usage
    • Response Time
    • Response Status Code
    • Controller and Route
    • Any Exceptions
    • Resonse Content Type
  • See Sub Requests
  • Filter by:
    • Request URL
    • Request Method
    • Response Status Code
    • Response Content Type
  • Color coded response types to easily spot errors, 404's and redirects
  • Easily links to WebProfilerBundle for full details of profile

Dependancies

  • WebProfilerBundle

If you are using the Symfony2 Standard Distribution the WebProfilerBundle
is already installed and configured.

Installation

  1. Add ProfilerLiveBundle to vendor dir:
* Using vendors script

    Add the following to the `deps` file:

        [ProfilerLiveBundle]
            git=git://github.com/dsyph3r/ProfilerLiveBundle.git
            target=/bundles/Profiler/LiveBundle

    Run the vendors script:

        $ php bin/vendors install

* Using git submodules:

        $ git submodule add git://github.com/dsyph3r/ProfilerLiveBundle.git vendor/bundles/Profiler/LiveBundle
  1. Add the Profiler namespace to your autoloader:

    // app/autoload.php
    $loader->registerNamespaces(array(
        // ..
        'Profiler'    => __DIR__.'/../vendor/bundles',
    ));
    
  2. Add bundle to application kernel:

    // app/ApplicationKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new Profiler\LiveBundle\ProfilerLiveBundle(),
        );
    }
    
  3. Add routing for ProfilerLiveBundle:

    # app/config/routing_dev.yml
    ProfilerLiveBundle:
        resource: "@ProfilerLiveBundle/Resources/config/routing.yml"
        prefix:   /
    
  4. Clear Cache

    $ php app/console cache:clear
    
  5. Install assets:

    $ php app/console assets:install --symlink web
    

Point your browser to http://yourdomain.com/app_dev.php/_live_profiler to run
the live profiler. Browse your application as normal in another tab/window.

Usage

The ProfilerLiveBundle is configured to use the existing Storage engine, by default
in the Symfony2 Standard Distribution this uses Sqlite. If you would like to
use MySql instead simply add the following paramaters to the file at
app/config/parameters.ini.

[parameters]
    profiler.storage.dsn = "mysql:host=localhost;dbname=profiler;"
    profiler.storage.username = %database_user%
    profiler.storage.password = %database_password%
    profiler.storage.class = Profiler\LiveBundle\Profiler\Storage\MysqlProfilerStorage

Contributing

The WebProfilerBundle uses a number of external libries including jQuery,
jQuery UI and underscore. CoffeeScript is also used so you must not edit the JavaScript
files in the folder Resources/public/js. Instead edit the
CoffeeScript files and compile this to JavaScript using something like the
following:

$ coffee --watch -o Resources/public/js -c Resources/data/coffee

Future features

There are a number of features I'd like to implement including:

  • Add support for additional DataCollectors in the WebProfilerExtraBundle so output for Assetics, Twig, Routing and the Container can be captured.
  • Add ability to Pause, Play and Step through the requests.
  • Memory management - At present there is no management of profiles, this will cause problems when a lot of requests have been sent over.
  • Add ability to load historic profiles - between date/time ranges.
  • Add more information into the Live Profile view. Information such as POST parameters should be available without having to click through to the WebProfilerBundle.
  • Possibly port over to Backbone.js. There wouldn't be more work in this as it is already using underscore.js and there are Model classes already defined.
  • Use Assetic to complie and output the CoffeeScript files into JavaScript.
  • Add support for graphing of profiled information such as number of database requests

Changelog

  • v0.1 (2011-10-20) - Initial release
profiler_live:        []
  • Merge pull request #9 from eXtreme/master
    By dsyph3r, 4 years ago
  • fix: keep sessions flashes
    By eXtreme, 4 years ago
  • Merge pull request #8 from hanken/master
    By dsyph3r, 4 years ago
  • change use of MessageCollector because its location has changed in the new syfony standard. it now lives in Bridge.
    By hanken, 4 years ago
  • Merge pull request #7 from HumanSourcing/master
    By dsyph3r, 4 years ago
  • fixed doctrine DataCollector definition
    By youbs, 4 years ago
  • Moves CoffeeScript files out of Resources/public into Resources/data
    By dsyph3r, 5 years ago
  • Merge pull request #2 from lsmith77/fix_service_overriding
    By dsyph3r, 5 years ago
  • Merge pull request #3 from lsmith77/CS_fixes
    By dsyph3r, 5 years ago
  • fix CS violations
    By lsmith77, 5 years ago
  • moved class overriding into a compiler pass
    By lsmith77, 5 years ago
  • CS fixes
    By lsmith77, 5 years ago
  • Update README.md
    By dsyph3r, 5 years ago
  • Updates Readme
    By dsyph3r, 5 years ago
  • Initial bundle commit
    By dsyph3r, 5 years ago