2017 © Pedro Peláez
 

library profiler

ZF2 Module. Allow profiling and log slow request

image

t4web/profiler

ZF2 Module. Allow profiling and log slow request

  • Friday, July 29, 2016
  • by maxgu
  • Repository
  • 3 Watchers
  • 0 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

Profiler

ZF2 Module. Allow profiling and log slow request, (*1)

Contents

Introduction

Module for allow profiling page load speed. You can add custom timers for detail analyze page loading workflow., (*2)

Installation

Main Setup

By cloning project

Clone this project into your ./vendor/ directory., (*3)

With composer

Add this project in your composer.json:, (*4)

"require": {
    "t4web/profiler": "~0.1.0"
}

Now tell composer to download T4web\Profiler by running the command:, (*5)

$ php composer.phar update

Post installation

Enabling it in your application.config.phpfile., (*6)

<?php
return array(
    'modules' => array(
        // ...
        'T4web\DefaultService',
        'T4web\Profiler',
    ),
    // ...
);

T4web\Profiler require T4web\DefaultService module., (*7)

Configuring

By default profiles not store (using NullAdapter), for storing page profiles into your DB, you can use DbAdapter. Run init script for create profiler table:, (*8)

$ php public/index.php profiler init

Change default StorageAdapter:, (*9)

'service_manager' => [
    'factories' => [
        \T4web\Profiler\StorageAdapter\StorageAdapterInterface::class => \T4web\Profiler\StorageAdapter\DbAdapterFactory::class,
    ],
],

Or, you can implement T4web\Profiler\StorageAdapter\StorageAdapterInterface for create own profiler storage., (*10)

By default profiler calculate basic ZF2 event execution:, (*11)

{
    "route": "1ms",
    "dispatch": "12ms",
    "render": "0ms",
    "finish": "0ms"
}

you can disable this like this:, (*12)

't4web-profiler' => [
    'profiling-timeout' => 500, // in ms
    'use-default-listeners' => false,
],

Profiler store request, which execute more than profiling-timeout option (500ms by default)., (*13)

Timers

You can add any custom timers. Timer - it's name and execution time., (*14)

$profiler = $serviceLocator->get(T4web\Profiler\Profiler::class);
$profiler->startTimer('My slow function');
// ...
$profiler->endTimer('My slow function');

The Versions