Download the PHP package slogger/laravel without Composer
On this page you can find all versions of the php package slogger/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download slogger/laravel
More information about slogger/laravel
Files in slogger/laravel
Package laravel
Short Description Tracing and observability for Laravel with dispatchers, masking, and profiling.
License MIT
Informations about the package laravel
SLogger Laravel
SLogger Laravel is a tracing/observability package for Laravel apps. It records request/command/job/event/etc. traces and delivers them to a remote backend via configurable dispatchers.
This README documents installation, configuration, watchers, masking, dispatchers, profiling, and usage patterns.
Requirements
- PHP >= 8.2
- Laravel 10+ (tested), should work on Laravel 12
- Queue driver for
queuedispatcher - Optional: XHProf extension for profiling
Installation
1) Install the package (via Composer in your app):
2) Publish config:
3) Configure env and config/slogger.php (see below).
Quick Start
Enable and use the queue dispatcher:
Then start dispatcher workers:
Trace Collection Backend
SLogger Laravel sends traces to a separate backend service. The reference backend project is:
Use its setup instructions to provision the server and configure the API client URL/token in this package.
Custom backend / client
You can replace the backend by providing your own API client. Redefine ApiClientFactory::create and return a custom implementation of SLoggerLaravel\\Dispatcher\\ApiClients\\ApiClientInterface that sends traces to your backend.
Configuration
All configuration lives in config/slogger.php with environment overrides. Key sections:
General
SLOGGER_ENABLED: globally toggle all tracing.SLOGGER_TOKEN: API token for dispatchers.SLOGGER_TRACE_ID_PREFIX: custom prefix for trace IDs. If empty, uses sluggedapp.nameorapp.SLOGGER_LOG_CHANNEL: where internal errors are logged.
Dispatchers
SLOGGER_DISPATCHER:queueormemory.queuedispatcher runs worker processes (similar to Horizon) and sends traces via HTTP or socket client.memorydispatcher stores traces in memory (useful for tests/dev).
Profiling
Enables XHProf profiling for HTTP client traces (see Profiling section).
Request parent trace header
Allows linking child traces to parent requests via a custom header.
Watchers (enable/disable)
What SLogger Writes
Each trace contains:
trace_id,parent_trace_id,type,status,tagsdata(watcher-specific payload)duration,memory,cpu,logged_at
Watcher data highlights:
request: url, method, action, headers/params, response (for JSON responses)job: connection, payload, status, exceptionevent: listeners, broadcast, optional serialized payloadmodel: action, model class, key, changesmail: from/to/cc/bcc, subject, queued, mailable/notificationnotification: notifiable, channel, queued, responsecache: type, key, tags, valuedb: query, bindings, timehttp-client: method, url, request/responseschedule: command, description, cron, outputdump,log,gate: dump/message/ability info
Requests
Middleware
For HTTP request tracing, add the middleware to the routes you want traced:
Request watcher config
config/slogger.php:
only_paths
only_paths(top-level): log only matched request paths.input.only_paths: apply input masking only to matched paths (others are scrubbed).output.only_paths: apply output masking only to matched paths (others are scrubbed).
Patterns use Laravel Str::is matching.
JSON response size
Large JSON responses are skipped and marked with:
Masking Rules
Masking is pattern-based and configurable.
Masked values keep basic types:
bool->falseint->0float->0.0string-> masked string- arrays/objects -> masked string
Guzzle / HTTP Client tracing
You can attach the SLogger handler to Guzzle:
Dispatchers
Queue dispatcher
Start the dispatcher (spawns queue workers):
- Parent traces are sent immediately.
- Child traces are batched (default batch size: 5).
- Orphan traces are sent immediately.
- On shutdown, remaining traces are flushed.
Stop the dispatcher:
Memory dispatcher
Stores traces in memory only. Intended for tests/local development.
Storage
SLogger does not persist traces locally. The only local file is the dispatcher state file in:
You may want to ignore the folder:
Profiling (XHProf)
Only for HTTP client tracing.
1) Install extension:
2) Enable in php.ini:
3) Enable:
Testing
Run tests:
The testbench config uses in-memory sqlite and memory dispatcher.
Troubleshooting
- Dispatcher not starting: verify
SLOGGER_ENABLED=trueand correct dispatcher name. - No traces: ensure watchers are enabled and middleware is applied for requests.
- Queue dispatcher not sending: check queue workers and API client URL.
- Socket client errors: verify socket address and backend availability.
License
MIT
All versions of laravel with dependencies
ext-posix Version *
laravel/framework Version ^10.0 | ^11.0 | ^12.0
symfony/process Version ^6.4|^7.0
php Version ^8.2