Profile Slim middleware, routes, and CLI workloads with lightweight performance monitoring
Perfbase gives Slim teams a pragmatic way to see request latency, route bottlenecks, and background work without turning a minimalist stack into a maintenance project.
Why teams choose Perfbase for Slim
Slim 4 middleware and Slim 3 middleware support
CLI trace runner for non-HTTP work
User resolver hooks for attribution
Slim
Performance monitoring for Slim 3 and Slim 4 applications
Supported versions
Slim 3 and Slim 4
Quick install
composer require perfbase/slimStarter config
use Perfbase\Slim\Slim4\PerfbaseMiddleware;
$app->add(new PerfbaseMiddleware([
'enabled' => true,
'api_key' => 'your-api-key',
]));Use cases
Why teams use Perfbase for Slim
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 Slim.
Keep Slim simple while gaining visibility
Add profiling without inflating a lean framework stack with custom observability plumbing.
Understand middleware cost clearly
See where authentication, routing, and downstream calls are adding latency in your request pipeline.
Cover HTTP and CLI paths together
Use the same profiling system for web traffic, cron scripts, workers, and command-line entrypoints.
Profiling coverage
What gets profiled and how Perfbase works in Slim
Perfbase stays framework-aware while keeping setup light. These are the behaviors and operational paths this integration is built to expose.
Slim 4 PSR-15 middleware
Standard PSR-15 middleware for Slim 4 applications.
Slim 3 middleware
Callable middleware support for Slim 3 applications.
CLI trace runner
Profile cron scripts, workers, and CLI commands with CliTraceRunner.
User ID resolver
Attach user identity with a callback-based resolver.
Route pattern naming
Low-cardinality span names are derived from Slim route patterns when available.
Include and exclude filters
Per-context filters for HTTP and CLI profiling.
Setup preview
How to get started with Perfbase in Slim
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 →
Slim 4 setup
Add the PSR-15 middleware to your Slim 4 app:
Open docs section →
Configuration
Pass a config array to the middleware constructor:
Open docs section →
CLI profiling
For non-HTTP entry points (cron scripts, CLI commands, workers), use CliTraceRunner:
Open docs section →
FAQ
Slim profiler and performance monitoring FAQ
Does Perfbase support both Slim 3 and Slim 4?
Yes. Perfbase supports both Slim 3 and Slim 4 so teams can standardize profiling even across mixed or migrating applications.
Can I profile non-HTTP Slim entrypoints?
Yes. Perfbase includes a CLI trace runner so workers, cron scripts, and command-line tasks can be profiled alongside HTTP routes.
Is Perfbase a good fit for lightweight Slim apps?
Yes. The integration is designed to stay lightweight while still giving you flame graphs, query visibility, and route-level performance insights.
Start profiling
Ready to start profiling production traffic?
Create a project, install the package, and start capturing framework-level traces in minutes.