GithubHelp home page GithubHelp logo

elao / webprofilerextrabundle Goto Github PK

View Code? Open in Web Editor NEW
263.0 32.0 48.0 194 KB

Adding routing, container, assetic & twig information in the web profiler

Home Page: http://www.elao.com

License: MIT License

PHP 43.75% HTML 56.25%

webprofilerextrabundle's Introduction

Elao WebProfilerExtraBundle

Total Downloads

What is this Symfony2 bundle for ?

It adds in your WebProfiler extra sections :

  • Routing : Lists all the routes connected to your application
  • Container : Lists all the services available in your container
  • Twig : Lists Twig extensions, tests, filters and functions available for your application
  • Assetic

WebProfilerExtraBundle

Installation

If you are working with Symfony >= 2.2

Add this in your composer.json

"require-dev": {
    [...]
    "elao/web-profiler-extra-bundle" : "~2.3@dev"
},

And run php composer.phar update elao/web-profiler-extra-bundle

If you are working with Symfony <= 2.1, prefer the 2.1 branch of this bundle "elao/web-profiler-extra-bundle" : "dev-2.1"

Register the bundle in your AppKernel (app/AppKernel.php)

Most of the time, we need this bundle to be only activated in the dev environment

[...]
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    [...]
    $bundles[] = new Elao\WebProfilerExtraBundle\WebProfilerExtraBundle();
}

Activate the different collectors in app/config/config_dev.yml

web_profiler_extra:
    routing:
        enabled:        true
        display_in_wdt: true
    container:
        enabled:        true
        display_in_wdt: true
    assetic:
        enabled:        true
        display_in_wdt: true
    twig:
        enabled:        true
        display_in_wdt: true

If you don't use assetic then you need to disable the assetic collector

web_profiler_extra:
    assetic:
        enabled:        false
        display_in_wdt: false

Install assets

Install assets by running to have beautiful icons in your debug bar

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

Screenshot

Screenshot

webprofilerextrabundle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webprofilerextrabundle's Issues

Latest Twig commit breaks

I get this error when installing the latest Twig
( ! ) Fatal error: Call to undefined method Twig_SimpleFilter::compile() in /vendor/elao\web-profiler-extra-bundle/Elao/WebProfilerExtraBundle/DataCollector/TwigDataCollector.php on line 59

Looks like it's due to this change https://github.com/fabpot/Twig/pull/905

Unrecognized options "routing, container, assetic, twig" under "web_profiler" ?

I wanted to try your Tool and installed it pretty well till the last Command

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

There i get an Exception from my YAML Config:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "routing, container, assetic, twig" under "web_profiler"

My config_dev.yaml looks like this:

web_profiler_extra:
    routing:
        enabled:        true
        display_in_wdt: true
    container:
        enabled:        true
        display_in_wdt: true
    assetic:
        enabled:        true
        display_in_wdt: true
    twig:
        enabled:        true
        display_in_wdt: true

Twig parameters not shown

With the latest update, the twig collector doesn't show any parameters / variables / templates .

version used: 2.1.9-DEV

Add option to disable showing parameters.yml content

Great bundle, but I have a small issue with it. The fact that it displays parameters.yml content. There should be an option to disable showing those contents. Sometimes they contain sensitive data and it might cause trouble. Obviously, the documentation does recommend storing sensitive data somewhere else, but in the development process it is easier to use this file.

What do you think?

unable to install on symfony 2.1

Hi,

It looks like there is a problem with the requirement in composer.json.
"symfony/framework-bundle": "~2.2",
You require the framework bundle to 2.2 version and it's thus not installable on symfony 2.1.*
I get

> composer update elao/web-profiler-extra-bundle
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for elao/web-profiler-extra-bundle dev-master -> satisfiable by elao/web-profiler-extra-bundle dev-master.
    - Conclusion: remove symfony/symfony v2.1.7
    - elao/web-profiler-extra-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony 2.2.x-dev, symfony/symfony 2.3.x-dev, symfony/framework-bundle 2.2.x-dev, symfony/framework-bundle 2.3.x-dev.
    - don't install symfony/framework-bundle 2.2.x-dev|don't install symfony/symfony v2.1.7
    - don't install symfony/framework-bundle 2.3.x-dev|don't install symfony/symfony v2.1.7
    - Can only install one of: symfony/symfony v2.1.7, symfony/symfony 2.2.x-dev.
    - Can only install one of: symfony/symfony v2.1.7, symfony/symfony 2.3.x-dev.
    - Installation request for symfony/symfony 2.1.7 -> satisfiable by symfony/symfony v2.1.7.

I saw that you have a a 2.1 branch but didn't found a way to tell composer to go there instead of the main one. And if it's what should be done then the readme.md should be updated too.

Thanks

Twig - value of parameters in template

Hi, I have made small modification which prints value of primitive data types in profiller.

zukg

Will it be useful for you? I can make pull-request with this change.

Conflict with Symfony core collectors

The routing data collector implemented in the bundle uses the same name than the core one, so it will replace it. This is a bad idea IMO.
thus, the implementation of your RoutingDataCollector is a performance killer by reloading the route collection on each request (which is something we avoided in the core one)

Symfony4 compatibility

When you're working on a new Symfony 4 project (which uses the new template syntax as default, the following error is thrown after requiring the bundle and disabling its twig support:

The profiler template "WebProfilerExtraBundle:Collector:routing.html.twig" for data collector "elao_routing" does not exist.

This is due to the fact that the old syntax of Bundle:Path:To:File.html.twig is deprecated, which is replaced by the @Bundle/Path/To/File.html.twig syntax. If this is not changed, it is not possible to use Symfony 3.4+'s new default_path for overriding template files. See symfony/symfony#25661.

Toolbar icons in svg

Yes, the eye sometimes wants something too ;]. Would be great if the toolbar icons were in vector too.

Don't know if any of the previous authors would still have the respective source files...

Loading multiple configs with different environments, is it intentional?

Hi there, I am currently using Behat under test environment to run behaviour driven features and the WebProfilerExtraBundle conflicted when the switching from multiple requests. Since I didn't need the extra tools under the dev environment, I went away and added in config_test.yml:

web_profiler_extra:
    routing:    false
    container:  false
    assetic:    false
    twig:       false

from config_dev.yml I have:

web_profiler_extra:
    routing:    true
    container:  true
    assetic:    true
    twig:       true

The thing is, it does not override, each config is parsed as a whole here:

class WebProfilerExtraExtension extends Extension
{
    protected $resources = array(
        'routing'     => array('file' => 'routing.xml'),
        'container'   => array('file' => 'container.xml'),
        'assetic'     => array('file' => 'assetic.xml'), 
        'twig'        => array('file' => 'twig.xml')
    );


    public function load(array $configs, ContainerBuilder $container)
    {
        foreach ($configs as $config) {
            $this->doConfigLoad($config, $container);
        }
    }

    protected function doConfigLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        foreach ($this->resources as $key => $resource) 
        {
            if (isset($config[$key]))
            {
                $loader->load($resource['file']);    
            }
        }
    }

Is this intentional? I am able to disable the profiler simply by using one overridable configuration like this:

class WebProfilerExtraExtension extends Extension
{
    protected $resources = array(
        'routing'     => array('file' => 'routing.xml'),
        'container'   => array('file' => 'container.xml'),
        'assetic'     => array('file' => 'assetic.xml'), 
        'twig'        => array('file' => 'twig.xml')
    );


    public function load(array $configs, ContainerBuilder $container)
    {
        $conf = array();
        foreach ($configs as $config) {
            $conf = array_merge($conf, $config);
        }

        $this->doConfigLoad($conf, $container);
    }

    protected function doConfigLoad(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        foreach ($this->resources as $key => $resource) 
        {
            if (isset($config[$key]) && $config[$key])
            {
                $loader->load($resource['file']);    
            }
        }
    }

I didn't think of other ways to disable it under the test env while still keeping it enabled for dev without doing the configuration overriding. What are your thoughts on that?

Best regards,
Steven Rosato

Show container using YamlDumper

I think it would be useful to show container definities in the web profiler dumped as yaml.
It will contain more info than the WebProfilerExtraBundle provides.
What do you think?

twig error

With 2.1 i get the following error to the latest update:

[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
The service "templating.engine.twig" has a dependency on a non-existent parameter "web_profiler_extra.templating.engine.twig.class".

guess it has to do with compiler pass.

This only happens if twig debugging is not enabled in the config!

Symfony 2.3.*@dev compatibilities

Stop me if I'm wrong, but I think that dev-master / 2.3.x-dev branch is for symfony 2.3.x versions, no ?

If yes, there is a dependencies issue:

  • elao/web-profiler-extra-bundle 2.3.x-dev requires symfony/twig-bundle >=2.0,<2.3-dev
  • BUT, with this configuration, symfony/twig-bundle require symfony/symfony 2.2.*

Try a composer.phar update, get this error (truncated):

  Problem 1
    - Installation request for symfony/symfony 2.3.*@dev -> satisfiable by symfony/symfony 2.3.x-dev.
    - elao/web-profiler-extra-bundle 2.3.x-dev requires symfony/twig-bundle >=2.0,<2.3-dev -> satisfiable by symfony/symfony v2.2.1, symfony/symfony 2.0.7, symfony/symfony 2.0.x-dev, symfony/symfony 2.1.x-dev, symfony/symfony 2.2.x-dev, symfony/symfony v2.0.10, symfony/symfony v2.0.11, symfony/symfony v2.0.12, symfony/symfony v2.0.13, symfony/symfony v2.0.14, symfony/symfony v2.0.15, symfony/symfony v2.0.16, symfony/symfony v2.0.17, symfony/symfony v2.0.18, symfony/symfony v2.0.19, symfony/symfony v2.0.20, symfony/symfony v2.0.21, symfony/symfony v2.0.22, symfony/symfony v2.0.23, symfony/symfony v2.0.9, symfony/symfony v2.1.0, symfony/symfony v2.1.0-BETA1, symfony/symfony v2.1.0-BETA2, symfony/symfony v2.1.0-BETA3, symfony/symfony v2.1.0-BETA4, symfony/symfony v2.1.0-RC1, symfony/symfony v2.1.0-RC2, symfony/symfony v2.1.1, symfony/symfony v2.1.2, symfony/symfony v2.1.3, symfony/symfony v2.1.4, symfony/symfony v2.1.5, symfony/symfony v2.1.6, symfony/symfony v2.1.7, symfony/symfony v2.1.8, symfony/symfony v2.1.9, symfony/symfony v2.2.0, symfony/symfony v2.2.0-BETA1, symfony/symfony v2.2.0-BETA2, symfony/symfony v2.2.0-RC1, symfony/symfony v2.2.0-RC2, symfony/symfony v2.2.0-RC3, symfony/symfony v2.2.1, symfony/twig-bundle 2.0.7, symfony/twig-bundle v2.0.10, symfony/twig-bundle v2.0.12, symfony/twig-bundle v2.0.13, symfony/twig-bundle v2.0.14, symfony/twig-bundle v2.0.15, symfony/twig-bundle v2.0.16, symfony/twig-bundle v2.0.17, symfony/twig-bundle v2.0.18, symfony/twig-bundle v2.0.19, symfony/twig-bundle v2.0.20, symfony/twig-bundle v2.0.21, symfony/twig-bundle v2.0.22, symfony/twig-bundle v2.0.23, symfony/twig-bundle v2.0.9, symfony/twig-bundle v2.1.0, symfony/twig-bundle v2.1.1, symfony/twig-bundle v2.1.2, symfony/twig-bundle v2.1.3, symfony/twig-bundle v2.1.4, symfony/twig-bundle v2.1.5, symfony/twig-bundle v2.1.6, symfony/twig-bundle v2.1.7, symfony/twig-bundle v2.1.8, symfony/twig-bundle v2.1.9, symfony/twig-bundle v2.2.0, symfony/twig-bundle v2.2.1.

I think you should require symfony/twig-bundle 2.3.x-dev in your composer.json isn't it ?

Call to undefined method Twig_Function_Method::getName()

Hi I have just created a new project running off sf2 2.2. and I am getting the following error message when enabling the twig part of the web_profiler_extra:

1/1 FatalErrorException: Error: Call to undefined method Twig_Function_Method::getName() in /home/touristtam/Projects/imbc/vendor/elao/web-profiler-extra-bundle/Elao/WebProfilerExtraBundle/DataCollector/TwigDataCollector.php line 62

Wrong condition for detect twig loader class

Elao\WebProfilerExtraBundle\TwigProfilerEngine::render:

$loader = $this->environment->getLoader();
if ($loader instanceof \Twig_Loader_Filesystem) {
    $templatePath = $loader->getCacheKey($name);
}

$loader in this code always has object of Twig_Loader_Chain class, which may contains Twig_Loader_Filesystem object inside.

Following condition is not correct. It's always return false.

Installation on Linux fails due to PhantomJS 2.0 being impossible to find

Trying to install the bundle on Linux Mint I get the message:

Installing assets for Elao\WebProfilerExtraBundle into web/bundles/webprofilerextra
  - Installing phantomjs (2.0.0)
    Downloading: connection...Script Ez\App\Installer::postInstall handling the post-install-cmd event terminated with an exception

  [Composer\Downloader\TransportException]                                                                                                          
  The "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-linux-x86_64.tar.bz2" file could not be downloaded (HTTP/1.1 404 NOT FOUND)

Which makes sense, since it's not in the repository

DEPRECATED

DEPRECATED - The Symfony\Component\Routing\Route::getPattern method is deprecated since version 2.2 and will be removed in 3.0. Use the getPath() method instead.

in File /vendor/elao/web-profiler-extra-bundle/DataCollector/RoutingDataCollector.php
Line 70
'pattern' => $route->getPattern(),
can you please fix it...

Symfony 3.4

After upgrading to Symfony 3.4 i have this warning:

User Deprecated: Implementing "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface" without the "reset()" method is deprecated since version 3.4 and will be unsupported in 4.0 for class "Elao\WebProfilerExtraBundle\DataCollector\ContainerDataCollector"

Thanks,

Paulo Dias

Compatibility symfony 2.7

Hello,

I have this message with Symfony 2.7 :
Defining the initRuntime() method in an extension is deprecated. Use the needs_environment option to get the Twig_Environment instance in filters, functions, or tests; or explicitly implement Twig_Extension_InitRuntimeInterface if needed (not recommended).

Symfony : 2.7.5
WebProfilerExtraBundle : 2.3-dev

What about removing dependency to assetic bundle?

Currently you have to require symfony/assetic-bundle to get this bundle work properly.

The https://github.com/symfony/web-profiler-bundle works without dependeny to assetic. What about removing this dependency in the WebProfilerExtraBundle also?

At least there should be a requirement to symfony/assetic-bundle stated in composer.json.
Without assetic bundle a ServiceNotFoundException will be thrown (You have requested a non-existent service "assetic.asset_manager".) and web profiler extra bundle will not work.

Keeping services lazy-loaded

You are instantiating all services in the ContainerDataCollector to get their class. This is a bad idea IMO as it can have a huge impact.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.