Download the PHP package kehikko/profiler without Composer
On this page you can find all versions of the php package kehikko/profiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package profiler
Profiling PHP
Generic profiling implementation for PHP.
Has a browser based UI to view profiled calls.
Tested with tideways and PHP 7.2 in Ubuntu 18.04.
All the code is based on a much older implementation that used xhprof and PHP 5.x (tested and used at least in Ubuntu 14.04 and CentOS/cPanel v???). Ported the code as a standalone version from Kehikko v1 framework when starting Kehikko v2.
Should still work even with PHP 5.x since no changes have been made to the core functionality, but I made PHP 7.0 as a requirement when installing this from Composer.
Requirements
PHP 7.0, PHP profiler extension (listed below) and command dot (from GraphViz). Twig is optional since it can be installed using Composer.
One of these PHP-extensions is required:
- tideways
- uprofiler
- xhprof
In Ubuntu 18.04 you should be able to install required depencies this way:
Simple test example
Do the following after you have installed tideways and graphviz:
And if you did this on your local machine, you should be able to browse to url http://localhost:8080
and see some results.
Install
To install this profiler into existing project, run:
If you plan to use this without Composer, you need to install Twig manually so that it is autoloaded when this profiler code is run.
The part that writes profiling data doe not need Twig. Only the part that is used to view profiled calls, needs Twig.
NOTE: Usually you probably do not want to install profiler into your project and
it should be installed elsewhere in a manner like in Simple test example and profiler.php
included
to your project from there only on local test installation.
Setup
Generating profiling data
Call profiler_start
from your code:
Call profiler_stop
later (or don't and let it be called automatically when PHP execution stops):
Also you can call profiler_running
to see whether or not profiler has been started:
Apache
Enable mod_rewrite in Apache and add/set this to your .htaccess
in your public web directory:
Create a PHP file called profiler.php
in that same directory with following contents:
Now you can see your profiled calls when browsing to http://your.web.server/_profiler
.
NOTE: This script assumes that Composer installed vendor
directory containing libraries is located one step down from the directory it is located in.
NOTE: At least in Ubuntu 18.04 systemd forces /tmp/
in PHP with apache to a different location,
usually /tmp/systemd-private-*-apache2.service-*/
. This is not the case when running PHP from command line,
so don't get baffled when profiling stuff in command line does not show up in your apache side.