PHPackages                             excimetry/excimetry - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. excimetry/excimetry

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

excimetry/excimetry
===================

Excimetry PHP package. Bridge between ext-eximer and open telemetry

1.0.3(10mo ago)602.2k↓34.3%1[3 issues](https://github.com/excimetry/excimetry/issues)1Apache-2.0PHPPHP ^8.2CI passing

Since Jul 6Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/excimetry/excimetry)[ Packagist](https://packagist.org/packages/excimetry/excimetry)[ RSS](/packages/excimetry-excimetry/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (7)Used By (1)

[![logo](https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/logo.jpg)](https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/logo.jpg)

Excimetry
=========

[](#excimetry)

Excimetry is a PHP profiling library that provides a bridge between the [ext-excimer](https://www.mediawiki.org/wiki/Excimer) extension and various profiling tools and platforms. It offers a simple and flexible way to profile PHP applications and export the results to various formats and backends.

[![Tests status](https://github.com/excimetry/excimetry/actions/workflows/tests.yml/badge.svg)](https://github.com/excimetry/excimetry/actions)[![Latest Stable Version](https://camo.githubusercontent.com/7c89ca76f133c7d4868b09037b30cda929902b6899abb6f904cce65c5dfa0714/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657863696d657472792f657863696d657472792e737667)](https://packagist.org/packages/excimetry/excimetry)[![License](https://camo.githubusercontent.com/dd2f3bcb5d5274faef895b6c34edb2d14a541587d42ad41588f7dd5d99d7261d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f657863696d657472792f657863696d657472792e737667)](https://packagist.org/packages/excimetry/excimetry)

Features
--------

[](#features)

- **Simple Configuration**: Easy setup with sensible defaults
- **Flexible Profiling**: Control when and how profiling happens
- **Multiple Export Formats**:
    - Collapsed format (for flamegraph tools)
    - [Speedscope JSON](https://www.speedscope.app/) (for interactive flame graphs)
    - OpenTelemetry OTLP (for integration with observability platforms)
- **Multiple Backends**:
    - Local file storage
    - HTTP/GRPC export to OpenTelemetry Collector
    - Pyroscope integration
- **OpenTelemetry Integration**: Connect profiles with traces and metrics
- **Command-line Tools**: Profile PHP scripts from the command line

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- [ext-excimer](https://www.mediawiki.org/wiki/Excimer) extension

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

[](#installation)

### Installing the ext-excimer Extension

[](#installing-the-ext-excimer-extension)

Before installing Excimetry, you need to install the ext-excimer extension. Here's how to do it:

#### Using PECL

[](#using-pecl)

```
pecl install excimer
```

Then add the following line to your php.ini file:

```
extension=excimer.so
```

#### From Source

[](#from-source)

```
git clone https://github.com/wikimedia/php-excimer.git
cd php-excimer
phpize
./configure
make
make install
```

Then add the following line to your php.ini file:

```
extension=excimer.so
```

### Installing Excimetry

[](#installing-excimetry)

Once you have the ext-excimer extension installed, you can install Excimetry using Composer:

```
composer require excimetry/excimetry
```

To use the command-line tool globally:

```
composer global require excimetry/excimetry
```

Basic Usage
-----------

[](#basic-usage)

Here's a simple example of how to use Excimetry to profile a PHP application:

```
use Excimetry\Profiler\ExcimerProfiler;
use Excimetry\Exporter\SpeedscopeExporter;
use Excimetry\Backend\FileBackend;

// Create a profiler with custom options
$profiler = new ExcimerProfiler([
    'period' => 0.01, // 10ms sampling period
    'mode' => 'wall',  // Wall time profiling (also supports 'cpu')
]);

// Start profiling
$profiler->start();

// Your code to profile here
// ...

// Stop profiling
$profiler->stop();

// Get the profile
$log = $profiler->getLog();

// Export to speedscope format and save to a file
$exporter = new SpeedscopeExporter('My Profile');
$backend = new FileBackend($exporter, 'profiles');
$backend->send($log);
```

Speedscope Export
-----------------

[](#speedscope-export)

[Speedscope](https://www.speedscope.app/) is an interactive flamegraph visualization tool that works in the browser. Excimetry can export profiles in the Speedscope JSON format, which can then be loaded into the Speedscope web app.

```
use Excimetry\Profiler\ExcimerProfiler;
use Excimetry\Exporter\SpeedscopeExporter;
use Excimetry\Backend\FileBackend;

// Create a profiler
$profiler = new ExcimerProfiler();

// Start profiling
$profiler->start();

// Your code to profile here
// ...

// Stop profiling
$profiler->stop();

// Get the profile
$log = $profiler->getLog();

// Export to speedscope format with a custom profile name
$exporter = new SpeedscopeExporter('My Custom Profile');
$backend = new FileBackend($exporter, 'profiles');

// Send the profile to the backend
$backend->send($log);

// The profile will be saved to a file in the 'profiles' directory
// You can then load this file into https://www.speedscope.app/
```

Command-line Profiling
----------------------

[](#command-line-profiling)

Excimetry includes a command-line tool for profiling PHP scripts. This is useful for profiling scripts that run from the command line, such as cron jobs or CLI applications.

```
# Basic usage
excimetry-profile path/to/script.php

# With custom options
excimetry-profile --period=0.01 --mode=wall --format=speedscope --output=profiles path/to/script.php

# Pass arguments to the script
excimetry-profile path/to/script.php arg1 arg2 arg3
```

Options:

- `--period=`: Sampling period in seconds (default: 0.01)
- `--mode=`: Profiling mode: wall or cpu (default: wall)
- `--format=`: Output format: speedscope or collapsed (default: speedscope)
- `--output=`: Output directory (default: profiles)
- `--help`: Display help message

OpenTelemetry Integration
-------------------------

[](#opentelemetry-integration)

[OpenTelemetry](https://opentelemetry.io/) is an observability framework for cloud-native software. Excimetry can send profiles to an OpenTelemetry Collector, which can then forward them to various backends.

```
use Excimetry\OpenTelemetry\OpenTelemetryIntegration;

// Create an integration with the OpenTelemetry Collector
$integration = OpenTelemetryIntegration::create(
    'http://localhost:4318', // OpenTelemetry Collector URL
    'my-service'             // Service name
);

// Start profiling
$integration->start();

// Your code to profile here
// ...

// Stop profiling and send to OpenTelemetry
$integration->stop();

// You can also add trace and span IDs to connect profiles with traces
$integration->addTraceId('trace-id');
$integration->addSpanId('span-id');

// Add custom metadata
$integration->addMetadata('version', '1.0.0');
$integration->addMetadata('environment', 'production');

// Access the underlying profiler and backend
$profiler = $integration->getProfiler();
$backend = $integration->getBackend();
```

Pyroscope Integration
---------------------

[](#pyroscope-integration)

[Pyroscope](https://pyroscope.io/) is a continuous profiling platform that helps you find performance issues in your code. Excimetry can send profiles directly to a Pyroscope server.

[![](https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/pyroscope-symfony-example.png)](https://raw.githubusercontent.com/excimetry/excimetry/refs/heads/main/static/pyroscope-symfony-example.png)

```
use Excimetry\Profiler\ExcimerProfiler;
use Excimetry\Exporter\CollapsedExporter;
use Excimetry\Backend\PyroscopeBackend;

// Create a profiler
$profiler = new ExcimerProfiler();

// Start profiling
$profiler->start();

// Your code to profile here
// ...

// Stop profiling
$profiler->stop();

// Get the profile
$log = $profiler->getLog();

// Send to Pyroscope
$exporter = new CollapsedExporter();
$backend = new PyroscopeBackend(
    serverUrl: 'http://localhost:4040',
    appName: 'my-application',
    labels: ['env' => 'production'],
    exporter: $exporter,
);

// Send the profile to Pyroscope
$backend->send($log);

// You can also set the backend to send asynchronously
$backend->setAsync(true);
$backend->send($log); // Returns immediately, sends in background

// Add custom labels
$backend->addLabel('version', '1.0.0');
$backend->addLabel('region', 'us-west');
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom Metadata

[](#custom-metadata)

```
$profiler = new ExcimerProfiler();
$profiler->addMetadata('version', '1.0.0');
$profiler->addMetadata('environment', 'production');
```

### Async Export

[](#async-export)

```
$backend = new HttpBackend($exporter, 'http://example.com/profiles');
$backend->setAsync(true);
$backend->send($log); // Returns immediately, sends in background
```

### Retry Configuration

[](#retry-configuration)

```
$backend = new HttpBackend($exporter, 'http://example.com/profiles');
$backend->setRetryConfig(5, 1000); // 5 retries, 1 second delay
$backend->send($log);
```

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

#### ext-excimer Not Found

[](#ext-excimer-not-found)

If you get an error like "Class 'Excimer' not found", it means the ext-excimer extension is not installed or not enabled. Make sure you have installed the extension and added it to your php.ini file.

#### Permission Issues

[](#permission-issues)

If you're having trouble saving profiles to a directory, make sure the directory exists and is writable by the PHP process.

#### Memory Issues

[](#memory-issues)

Profiling can use a significant amount of memory, especially for long-running processes. If you're experiencing memory issues, try increasing the memory limit in your php.ini file or reducing the sampling frequency.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance54

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

306d ago

PHP version history (2 changes)1.0.0PHP 8.2.\*

1.0.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d3d97948330b4dfa2ef3524f508b80d19a47a5ad601359f23c7ddb1c8af5e49?d=identicon)[olegmifle](/maintainers/olegmifle)

---

Top Contributors

[![olegmifle](https://avatars.githubusercontent.com/u/9926047?v=4)](https://github.com/olegmifle "olegmifle (20 commits)")[![jetbrains-junie[bot]](https://avatars.githubusercontent.com/in/1164761?v=4)](https://github.com/jetbrains-junie[bot] "jetbrains-junie[bot] (2 commits)")

---

Tags

excimeropentelemetryprofilingpyroscopelibraryprofilingopentelemetrypyroscopeeximerexcimetry

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/excimetry-excimetry/health.svg)

```
[![Health](https://phpackages.com/badges/excimetry-excimetry/health.svg)](https://phpackages.com/packages/excimetry-excimetry)
```

###  Alternatives

[filp/whoops

php error handling for cool kids

13.2k402.4M1.4k](/packages/filp-whoops)[laracraft-tech/laravel-xhprof

Easy XHProf setup to profile your laravel application!

235321.4k](/packages/laracraft-tech-laravel-xhprof)[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22156.6k](/packages/bavix-laravel-xhprof)[ikkez/f3-falsum

Pretty error handling for Fat-Free Framework

21145.8k3](/packages/ikkez-f3-falsum)[upscale/swoole-blackfire

Blackfire profiler integration for Swoole web-server

22114.0k8](/packages/upscale-swoole-blackfire)[zoon/pyrospy

Adapter from phpspy to pyroscope

257.4k](/packages/zoon-pyrospy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
