SPX logo

SPX

Lightweight self‑hosted PHP profiler with instant UI

SPX provides zero‑configuration profiling for PHP scripts via an environment variable or web UI, offering 22 metrics, timeline, flat profile and flamegraph visualizations without sending data to external services.

Overview

Overview

SPX is a lightweight profiling extension for PHP that can be turned on with a single environment variable or through an integrated web control panel. It captures up to 22 different metrics—including wall‑time, memory usage, I/O statistics and object counts—and preserves the full call stack, enabling timeline, flat‑profile and flamegraph visualizations without aggregating caller/callee pairs.

Who should use it

The extension is aimed at developers and teams working on Linux, macOS or FreeBSD systems who need quick, on‑premise performance insight for PHP 5.4‑8.x applications. It works for both CLI scripts and HTTP requests, requiring only the PHP development headers and the zlib development package to compile.

Deployment

Install the extension from source, add extension=spx.so to your php.ini (or a dedicated spx.ini), and optionally configure spx.http_profiling_enabled for automatic profiling. For PHP‑FPM setups, enable process.dumpable = yes in the pool configuration to allow procfs access. The built‑in UI is served by SPX itself, eliminating the need for external tools.

Highlights

Zero‑config activation via environment variable or web UI
22 built‑in metrics covering time, memory, I/O, and objects
Interactive UI with timeline, flat profile, and flamegraph
Supports PHP 5.4‑8.x on Linux, macOS, FreeBSD (x86‑64/ARM64)

Pros

  • No data leaves your infrastructure
  • Simple enable/disable without code changes
  • Rich visualizations for deep performance analysis
  • Works for both CLI scripts and web requests

Considerations

  • Experimental status; API may change
  • Limited to Linux, macOS, FreeBSD platforms
  • Small overhead, especially on ZTS PHP
  • Requires PHP and zlib development packages

Managed products teams compare with

When teams consider SPX, these hosted platforms usually appear on the same shortlist.

Blackfire Continuous Profiler logo

Blackfire Continuous Profiler

Low-overhead continuous profiling for app performance optimization.

Datadog Continuous Profiler logo

Datadog Continuous Profiler

Always-on code profiling to cut latency and cloud costs.

Elastic Universal Profiling logo

Elastic Universal Profiling

Whole-system, always-on profiling with no instrumentation.

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Developers needing quick performance insight during local development
  • Teams that must keep profiling data on‑premise
  • Projects targeting PHP 5.4‑8.x on supported OS/arch
  • CLI tools or long‑running scripts where instant flat profile is useful

Not ideal when

  • Production environments with strict stability requirements
  • Windows deployments
  • High‑traffic sites where storage consumption could be high
  • Applications requiring stable, long‑term API guarantees

How teams use it

Profiling a Composer update

Identify functions consuming most time and memory to speed up dependency management

Analyzing a Laravel web request

Visualize call stack with flamegraph to optimize controller and middleware performance

Measuring I/O impact of a file‑processing script

Capture I/O metrics and reduce bottlenecks in data‑intensive operations

Debugging memory leaks in a daemon

Track object allocation over time to locate and fix leaks

Tech snapshot

C51%
JavaScript26%
PHP14%
HTML7%
CSS1%
M41%

Tags

data-visualizationperformance-analysisphp-extensionreverse-engineeringvisualizationprofilertracerphpflamegraphstatistical-profiling

Frequently asked questions

How do I enable profiling for a web request?

Add `SPX_KEY=dev` and `SPX_ENABLED=1` as query parameters or cookies, or enable it via the built‑in web UI control panel.

Can SPX be used with PHP‑FPM?

Yes, but you must set `process.dumpable = yes` in the FPM pool configuration so child processes can read `/proc/self`.

What PHP versions are supported?

SPX supports PHP 5.4 through 8.x on the listed platforms.

Does SPX send any profiling data to external services?

No, all data is collected and stored locally; there is no SaaS component.

Is SPX compatible with ZTS (thread‑safe) PHP?

ZTS is supported in beta, but it adds a small overhead and may increase the risk of segfaults.

Project at a glance

Active
Stars
2,538
Watchers
2,538
Forks
100
LicenseGPL-3.0
Repo age8 years old
Last commitlast month
Primary languageC

Last synced 12 hours ago