saloonphp/barstool
Laravel package that automatically logs Saloon requests and responses to your database for easy searching and filtering. Captures method, URL, headers/body, status, duration, and even fatal errors, with optional config and model pruning support.
Barstool is a dedicated Laravel package to help you keep track of your Saloon requests & responses.
Barstool will allow you to easily view, search, and filter your logs directly in your database tool of choice.
The package is designed to be as simple as possible to get up and running, with minimal configuration required.
So pull up a barstool, grab a drink, and let's get logging in the Saloon! Yeehaw!
You can install the package via composer:
composer require saloonphp/barstool
You can publish and run the migrations with:
php artisan vendor:publish --tag="barstool-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="barstool-config"
You should also set up Laravel Model Pruning in your scheduler. Please check the Laravel Documentation for your version to know where to put the code below.
use Saloon\Barstool\Models\Barstool;
Schedule::command('model:prune', [
'--model' => [Barstool::class],
])->daily();
That's all folks! Once installed, it will start logging your Saloon requests automatically. Check the config out for more control.
Here are some of the things you can see with Barstool:
The logging will even log fatal errors caused by your saloon requests so you can see what went wrong.
[!TIP] We will be adding more features soon, so keep an eye out for updates!
By default, Barstool writes recordings to the database synchronously. If you'd like to offload this to a queue, you can enable it in the config:
// config/barstool.php
'queue' => [
'enabled' => env('BARSTOOL_QUEUE_ENABLED', false),
'connection' => env('BARSTOOL_QUEUE_CONNECTION'), // null uses default connection
'queue' => env('BARSTOOL_QUEUE_NAME'), // null uses default queue
],
Or simply set BARSTOOL_QUEUE_ENABLED=true in your .env file.
When queue support is enabled, recordings are dispatched as jobs instead of being written inline. Each job is unique (preventing duplicates) and uses idempotent writes (updateOrCreate), so recordings are safe even if a job is retried. Failed jobs will automatically retry up to 3 times with a backoff of 5 and 30 seconds.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email barstool@craigpotter.co.uk instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?