Php

PHP Monitoring Quick Start Guide

Getting started with Instrumental and PHP

Here's how to get up and running with PHP application monitoring and Instrumental. Like all our agents, the PHP agent is designed to prevent exceptions from impacting your application.

Installation

Add the agent to your Composer file:

composer require instrumental/instrumental_agent

Configure it with your project token.

$I = new \Instrumental\Agent();
$I->setApiKey("AREALWORKINGKEY");
$I->setEnabled($isProduction); // only send metrics in production

Sending Metrics

Increments are simple counters. learn more

$I->increment('signups');

Gauges represent a value at a point in time. learn more

$I->gauge('load', 1.23);

The time method measures code execution time.

$post = $I->time('query_time', function(){
  return Post->find(1);
});

Sending Notices

Notices are project specific events.

$I->notice("Deployed revision 038ade4 to production");
$I->notice("event in the past with a duration", time() - (3*24*60*60), 20*60);

More PHP + Instrumental

Php book

Complete PHP Agent Docs

Everything to know about the Instrumental PHP agent, including setup, backfilling and more!

go to docs
Instrumental book

Where to Start Monitoring

Not sure what to measure? This guide will help you decide where to start!

read the guide

Using StatsD or statsite? We’ve got you covered with our StatsD backend and statsite sink