Releases: Treblle/treblle-php
Release list
v6.0.0
This is a full rewrite of the SDK with a huge focus on improved performance, improved networking, improved memory footprint and complelty new features.
Automated async delivery
In v5, background sending required manually opting in via config['fork_process' => true] and having pcntl available. In v6 the SDK picks the best available strategy at runtime - no configuration required.
Metadata
Attach custom key/value pairs to any request that appear on the Treblle dashboard and can be filtered and searched. Call Treblle::metadata() anywhere during the request lifecycle in a middleware, after authentication, inside a controller. Multiple calls are merged.
Circuit breaker
The SDK now tracks ingress failures and protects your application from stacking network calls against an unavailable endpoint.
- 429 responses opens the circuit immediately for Retry-After seconds (defaults to 60s if the header is absent)
- 5xx / network errors counted against a threshold; once crossed, exponential backoff kicks in (30s base, doubling per failure, capped at 30 minutes)
- Half-open probing exactly one worker is allowed through after the backoff expires to test recovery; all others are held back, preventing a thundering herd
- Jitter ±20% randomisation on every backoff interval to spread recovery probes across instances
- Storage backends APCu when available (shared across FPM workers), file-based fallback for single-process environments
PSR-15 middleware
TreblleMiddleware integrates directly into any PSR-15 compatible framework (Slim, Mezzio, Laravel via league/route, etc.). It reads from PSR-7 objects no output buffering and ships the payload asynchronously via a shutdown function after the response has been delivered.
Route path detection
Plain PHP has no built-in router, so v6 provides two explicit mechanisms to supply the parameterised route pattern:
// After your router resolves the route
Treblle::setRoutePath('articles/{id}');
// Or via server variable (useful for .htaccess setups)
$_SERVER['TREBLLE_ROUTE_PATH'] = 'articles/{id}';
setRoutePath() always takes priority.
New configuration API
TreblleFactory::create() is gone. Initialisation now goes through Treblle::create() directly with a cleaner options array.
For full control, construct a TreblleConfig object and pass it to Treblle::start().
Smarter masking
- Masking is now recursive nested objects and arrays are fully traversed
- Authorization is masked with scheme-preserving formatting: Bearer **** instead of replacing the entire value with stars
- Base64-encoded images (data:image/...) are replaced with [image] to avoid bloating payloads
- Keywords are stored in a lowercase hash map for O(1) lookup regardless of list size
No Guzzle
v6 uses native PHP curl only. If Guzzle was pulled in solely for Treblle, it can be removed:
composer remove guzzlehttp/guzzle
Persistent runtime support
For long-lived processes (Swoole, RoadRunner, FrankenPHP, ReactPHP), call Treblle::reset() at the start of each request cycle to clear all per-request state metadata, route path, cached request data, and the initialization flag so the next request starts clean.
Requirements
- PHP ^8.2
- ext-curl, ext-json, ext-mbstring, ext-zlib
v5.0.1
- Remove silent catch in buildPayload() so exceptions propagate to
onShutdown(), eliminating the [] return path that caused the ingress
unmarshal error - onShutdown() now returns early on any failure instead of sending a
malformed error payload to Treblle - Replace mb_trim() (PHP 8.4+) with trim() in response header parsing,
fixing a fatal error on PHP 8.2/8.3 - Remove mb_str_functions Pint rule which was silently re-introducing
PHP 8.4-only functions on every format run - Guard getallheaders() against false return with ?: []
- Add null coalescence to HTTP_HOST and REQUEST_URI in URL construction
- Updated README
v5.0.1-beta.1
Various bug-fixes and improvements
v5.0.0
4.0.2
4.0.1
4.0.0
3.0.1
Multi-process processing
What's Changed
- remove: composer lock file shouldnt be part of packages so removed by @bhushan in #7
- chore: updated gitignore to have composer lock by @bhushan in #9
- refactor: php-cs-fixer changes with formatting and renaming data providers by @bhushan in #8
- feat: create child process for calling guzzle http request by @bhushan in #10
New Contributors
Full Changelog: 2.0.4...3.0.0
Perfomrance update
Added a load balancing on the SDK side that randomly selects one of our endpoints and send the payload data there. Should improve timeouts and performance. Fixed a bunch of styling problems and QC.