Download the PHP package soc-warden/php-sdk without Composer
On this page you can find all versions of the php package soc-warden/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download soc-warden/php-sdk
More information about soc-warden/php-sdk
Files in soc-warden/php-sdk
Package php-sdk
Short Description SOCWarden security observability SDK for PHP (framework-agnostic)
License MIT
Informations about the package php-sdk
SOCWarden PHP SDK
Framework-agnostic PHP SDK for SOCWarden security observability. Works with any PHP 8.2+ application -- no Laravel or Symfony dependency required.
Installation
Quick Start
Fluent Event Builder
Raw Data Array
PSR-15 Middleware (Slim, Mezzio, etc.)
The SDK ships with a PSR-15 middleware that automatically captures request context (method, path, query string, IP, user agent, referer) and attaches it to every tracked event.
Slim 4
Mezzio (Laminas)
Manual Request Context
If you are not using PSR-15 middleware, you can set the request manually:
Constructor Options
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
(required) | Your SOCWarden API key |
endpoint |
string |
(required) | SOCWarden ingestor base URL |
timeout |
int |
5 |
HTTP timeout in seconds |
autoContext |
bool |
true |
Auto-collect server/request context |
browserContextHeader |
string |
X-SOCWarden-Context |
Header for browser-side context JSON |
Auto-Context
When autoContext is enabled (default), every event automatically includes:
- SDK info: name (
socwarden-php), version - Server info: hostname, PHP version, PID
- Request info (when a PSR-7 request is set): method, path, sanitized query string, referer, origin, content type, accept language, request ID
- Browser context: parsed from the
X-SOCWarden-Contextheader (set by the browser SDK)
Sensitive query string parameters (token, key, password, secret, code, auth, session, csrf) are automatically redacted.
Rate Limit Handling
The SDK automatically handles HTTP 429 responses with file-based backoff:
- On 429, the SDK backs off for 1 hour (or the server's
Retry-Aftervalue) - During backoff, a probe request is sent every 5 minutes to check if quota is restored
- On success, the backoff is automatically cleared
- Backoff state is stored in
sys_get_temp_dir()so it persists across requests
Event Type Format
Event types must match the pattern: ^[a-z][a-z0-9]{0,29}(\.[a-z][a-z0-9_]{0,29}){1,3}$
Examples: auth.login.success, data.exported, server.ssh.login.failure
License
MIT