ZendDeveloperTools module not displaying a toolbar

2020-04-07 04:46发布

问题:

I'm trying to install the ZendDeveloperTools modules for ZF2 beta5. Here are the steps I followed so far:

-Successfully installed ZendSkeletonApplication.
-Downloaded the module into my ./vendor directory.
-Enabled the module in ./config/application.config.php:

<?php
return array(
    'modules' => array(
        'Application',
        'ZendDeveloperTools',   // Added this line
    ),
    'module_listener_options' => array(
        'config_glob_paths'    => array(
            'config/autoload/{,*.}{global,local}.php',
        ),
        'module_paths' => array(
            './module',
            './vendor',
        ),
    ),
);

-Copied ./vendor/ZendDeveloperTools/config/zenddevelopertools.local.php.dist to ./config/autoload/zenddevelopertools.local.php.

-Edited zenddevelopertools.local.php as follows:

<?php

return array(
    'zdt' => array(
        'profiler' => array(
            'enabled' => true,
            'strict' => true,
            'verbose' => true,
            'flush_early' => false,
            'cache_dir' => 'data/cache',
            'collectors' => array(),
            'verbose_listeners' => array('application' => array(
                    'ZDT_TimeCollectorListener' => true,
                    'ZDT_MemoryCollectorListener' => true,
            ))
        ),
        'toolbar' => array(
            'enabled' => true,
            'auto_hide' => false,
            'position' => 'bottom',
            'version_check' => false,
            'entries' => array(),
        ),
    ),
);

-Added define('REQUEST_MICROTIME', microtime(true)); in my ./public/index.php
-Replaced my ./composer.json with the one provided in the ZendDeveloperTools module.
-Removed the , at the end of line 29 which was causing problems (shouldn't be there):

-Ran a composer update :

$ php composer.phar update
Updating dependencies
  - Updating zendframework/zendframework (dev-master)
    Checking out 9f4dd7f13c8e34362340072d0e2d13efe15e4b1f

Writing lock file
Generating autoload files

-Added error_reporting(E_ALL); ini_set('display_errors', '1'); to ./public/index.php to catch potential errors

When I access my application I don't get any errors (I get the skeleton application home page) but the zend developer toolbar isn't show up

What am I missing to make use of and display the zend developer toolbar?

回答1:

It was a stupid mistake, I had placed zenddevelopertools.local.php into ./config and not ./config/autoload. Above instructions are correct. Here is what the toolbar looks like for those who are curious:



回答2:

Worked for me, but one change I had to make for my app was rename the config from:

zenddevelopertools.local.php

to:

zenddevelopertools.local.config.php

Also, I installed BjyProfiler, which "just worked" with my Doctrine2 setup (nice!). The only caveat was that I had to add the default SM factory config so it would stop throwing errors:

'service_manager' => array(
    'factories' => array(
        /**
         * This default Db factory is required so that ZDT 
         * doesn't throw exceptions, even though we don't use it
         */
        'Zend\Db\Adapter\Adapter' => function ($sm) use ($dbParams) {
            $adapter = new BjyProfiler\Db\Adapter\ProfilingAdapter(array(
                'driver'    => 'pdo',
                'dsn'       => 'mysql:dbname=skunk;host=hunk',
                'database'  => 'bunk',
                'username'  => 'junk',
                'password'  => 'punk',
                'hostname'  => 'lunk',
            ));

            $adapter->setProfiler(new BjyProfiler\Db\Profiler\Profiler);
            $adapter->injectProfilingStatementPrototype();
            return $adapter;
        },
    ),
),

See the screenshot: