PHPackages                             jcm/footprint-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. jcm/footprint-php

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

jcm/footprint-php
=================

composer package that allows you to monitor and retrieve custom stats about your running php script

v1.2(5y ago)416MITPHPPHP ^7.0

Since Jan 14Pushed 5y ago3 watchersCompare

[ Source](https://github.com/juan-morales/footprint-php)[ Packagist](https://packagist.org/packages/jcm/footprint-php)[ RSS](/packages/jcm-footprint-php/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

footprint-php
=============

[](#footprint-php)

[![Latest Stable Version](https://camo.githubusercontent.com/94fad2ee81ea22697e723da3568a8242f967d1816ec6c695b1d42f8deb82d18a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a636d2f666f6f747072696e742d706870)](https://camo.githubusercontent.com/94fad2ee81ea22697e723da3568a8242f967d1816ec6c695b1d42f8deb82d18a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a636d2f666f6f747072696e742d706870)[![Latest Release Version](https://camo.githubusercontent.com/1f1fc0a2520172d19617d439930a5ce68483d4efba99826d82ce1fb484f19819/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a75616e2d6d6f72616c65732f666f6f747072696e742d706870)](https://camo.githubusercontent.com/1f1fc0a2520172d19617d439930a5ce68483d4efba99826d82ce1fb484f19819/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a75616e2d6d6f72616c65732f666f6f747072696e742d706870)[![Total Downloads](https://camo.githubusercontent.com/a946404ee48673342f5606ecb05b42160f99e5897a07d948e107fad3a599b7a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a636d2f666f6f747072696e742d706870)](https://camo.githubusercontent.com/a946404ee48673342f5606ecb05b42160f99e5897a07d948e107fad3a599b7a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a636d2f666f6f747072696e742d706870)[![License](https://camo.githubusercontent.com/66d7f88fe6eb0b5ae64c3820e170923ea75021cfb13806fd121945a60a7e8b9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a636d2f666f6f747072696e742d706870)](https://camo.githubusercontent.com/66d7f88fe6eb0b5ae64c3820e170923ea75021cfb13806fd121945a60a7e8b9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a636d2f666f6f747072696e742d706870)

Composer package that allows you to trace/monitor and retrieve/calculate/generate custom stats about your running php script.

It is build in a modular way and event triggers, really easy to follow and customize.

The package already comes with some modules likes:

- ChartJS line chart report (output only)
- CSV report (log and output)
- Time tracking (log)
- Memory tracking (log)

Code is really simple and short, so you can quickly pick it up and create your own code.

Quick intro
===========

[](#quick-intro)

Installation
------------

[](#installation)

```
composer require jcm/footprint-php

```

Step by Step usage example and output
-------------------------------------

[](#step-by-step-usage-example-and-output)

In this code we want to measure how much time and memory a function call or class method uses.

Keep in mind that is a demo example, **you will not have to initialize more than once if you code properly**.

Basically in the example we create a class called `SomeClassName` with a method called `testMethod` and we are gonna measure time and memory usage of this method when its called.

We will do this example by creating a php project from scratch, if you already have a project, adjust the example to your needs.

#### Step 1: Create a php project with composer

[](#step-1-create-a-php-project-with-composer)

Run `composer init` and create a **project** , name it as you want.

While the wizard asks you different questions about the project, it will ask you about what dependencies you want to install, leave it blank for now.

It looks something like this: `Would you like to define your dependencies (require) interactively [yes]? no` answer no.

#### Step 2: Install footprint-php package

[](#step-2-install-footprint-php-package)

Run `composer require jcm/footprint-php`

You should get an output like this:

```
Using version ^1.1 for jcm/footprint-php
./composer.json has been updated
Running composer update jcm/footprint-php
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking jcm/footprint-php (v1.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing jcm/footprint-php (v1.1): Extracting archive
Generating autoload files

```

#### Step 4: Create an index.php with our code

[](#step-4-create-an-indexphp-with-our-code)

Run `touch index.php`

With the following code inside

```
