Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Saloon Logger Plug In

Saloon Logger Plug In Laravel Package

bit-mx/saloon-logger-plug-in

Laravel plug-in for Saloon v3 that logs HTTP requests, responses, and exceptions to the database with a shared ULID trace_id for end-to-end traceability. Includes automatic sanitization of sensitive headers/fields and simple trait-based setup.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Saloon Logger Plug In
How do I integrate this package into an existing Laravel app using Saloon v3?
First, install via Composer (`composer require bit-mx/saloon-logger-plug-in`), publish the migrations (`php artisan vendor:publish --tag=saloon-logger-migrations`), and run `php artisan migrate`. Then, apply the `HasLogging` trait to your connector and `ProvidesDefaultBody` to your request class. No additional configuration is needed unless you want to customize sanitization.
Does this package work with Laravel 10 or older versions?
This package requires PHP 8.2+ and Laravel 12.35.0+. For Laravel 10 or older, you’ll need to upgrade Saloon to v3+ and ensure PHP compatibility. Check the [Saloon upgrade guide](https://docs.saloon.dev/upgrade) for version-specific requirements.
Can I customize which fields are sanitized in logs?
Yes, publish the config file with `php artisan vendor:publish --tag=saloon-logger-config` to customize the `saloon-logger.php` file. You can define arrays of fields to censor in headers, requests, and responses, such as passwords or API keys.
Will this package impact performance in high-traffic Laravel apps?
The package is designed to be lightweight, but logging to the database adds minor overhead. For high-throughput apps (e.g., >1000 RPS), consider logging only debug-level requests or using a dedicated logging service like Sentry or Datadog instead of database storage.
How do I query or analyze the logged HTTP interactions?
The package creates a dedicated `saloon_logs` table with columns like `trace_id`, `request`, `response`, and `exception`. You can query this table directly or integrate it with Laravel Scout, Elasticsearch, or other analytics tools for advanced filtering and visualization.
Is there a way to log only specific endpoints or requests?
Currently, the package logs all requests made through connectors with the `HasLogging` trait. To log selectively, create separate connectors for critical endpoints and omit the trait from non-critical ones. Future updates may add granular logging controls.
Can I use this with other Saloon plugins like RetryPlugin?
Yes, this package is designed to work alongside other Saloon plugins. The `LoggerPlugin` integrates seamlessly with plugins like `RetryPlugin` or `QueuePlugin`, ensuring all HTTP interactions—including retries—are logged with the same `trace_id`.
What happens if my Laravel app crashes during an HTTP request?
The package logs requests, responses, and exceptions independently. If the app crashes, the request and response will still be recorded in the database, provided the database connection remains active. Exceptions are logged separately with their own `trace_id` for debugging.
Are the logs stored in JSON format for compatibility with ELK or Datadog?
The logs are stored in a structured database table, not raw JSON. However, you can export the data to JSON for ELK or Datadog by querying the `saloon_logs` table and formatting the output. The package’s design prioritizes database reliability over log aggregation tools.
What alternatives exist if I’m not using Saloon in my Laravel app?
If you’re using Guzzle or Laravel’s built-in HTTP client, consider Guzzle’s `LogMiddleware` or Laravel’s `tap()` method for logging. For more advanced observability, packages like Spatie’s Laravel Monitoring or Sentry provide broader integration with error tracking and performance metrics.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime