Add profiling and performance monitoring to any PHP application with the Perfbase SDK
When your stack does not have a first-party package, the Perfbase PHP SDK gives you manual spans, custom attributes, and framework-agnostic performance monitoring on top of the native extension.
Why teams choose Perfbase for PHP SDK
Framework-agnostic API surface
Works with the Perfbase native extension
Manual spans, attributes, and feature flags
PHP SDK
Framework-agnostic profiling for any PHP application
Supported versions
Any PHP 7.4+ application
Quick install
composer require perfbase/perfbase-sdkStarter config
use Perfbase\SDK\Perfbase;
use Perfbase\SDK\Config;
$config = Config::fromArray([
'api_key' => 'your-api-key',
]);
$perfbase = new Perfbase($config);Use cases
Why teams use Perfbase for PHP SDK
Perfbase is built for teams that need more than a local debug toolbar. It brings production-facing traces, framework-specific context, and shared visibility across the slow paths that matter most in PHP SDK.
Cover stacks that have no package yet
Use the same profiling platform across bespoke frameworks, legacy apps, and custom runtime entrypoints.
Instrument only what matters
Add spans and attributes where they create the most value instead of waiting for framework-specific automation.
Standardize performance workflows across PHP codebases
Use one ingestion and analysis platform even when each app has a different structure.
Profiling coverage
What gets profiled and how Perfbase works in PHP SDK
Perfbase stays framework-aware while keeping setup light. These are the behaviors and operational paths this integration is built to expose.
Works everywhere
Any PHP 7.4+ application can use the SDK. Use framework packages when automatic profiling is available.
Simple API
Use startTraceSpan, stopTraceSpan, and submitTrace to build the profiling flow you need.
Custom attributes
Attach metadata to traces with setAttribute().
Feature flags
Use bitwise flags to control which subsystems are profiled.
SubmitResult handling
Typed result objects distinguish success, retryable, and permanent failures.
Fail-open design
Submission failures return results instead of taking your application down.
Setup preview
How to get started with Perfbase in PHP SDK
Start with install, configuration, and the first framework-specific profiling steps here. When you want full implementation detail, each card links directly into the complete guide.
Installation
Install the Perfbase PHP extension first. This is what does the actual profiling:
Open docs section →
Quick start
That's it. The trace appears in your Perfbase dashboard within seconds.
Open docs section →
Profiling spans
A span represents a unit of work you want to profile, typically one HTTP request, queue job, or CLI command.
Open docs section →
Submitting traces
submitTrace() sends the profiling data to Perfbase and returns a SubmitResult:
Open docs section →
FAQ
PHP SDK profiler and performance monitoring FAQ
When should I use the PHP SDK instead of a framework package?
Use the SDK when your framework has no first-party Perfbase package or when you need fully manual control over where spans start and stop.
Can the SDK profile CLI workers and cron jobs?
Yes. The SDK works for any PHP entrypoint, including daemons, workers, scheduled scripts, and long-running commands.
Does the SDK still require the Perfbase extension?
Yes. The native extension does the actual low-level profiling. The SDK configures it and submits the collected trace data.
Start profiling
Need profiling in a framework we do not support yet?
Start with the PHP SDK today, then layer in framework-specific automation as your stack evolves.