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

Barstool Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Barstool

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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!

Installation

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();

Usage

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:

  • Request Method
  • Connector Used
  • Request Used
  • Request URL
  • Request Headers
  • Request Body
  • Response Status Code
  • Response Headers
  • Response Body
  • Response Duration

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!

Queue Support

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.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

If you discover any security related issues, please email barstool@craigpotter.co.uk instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

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.
ilhamsyabani/laravel-volt-starter
thethunderturner/filament-latex
ghostcompiler/laravel-querybuilder
webrek/laravel-telescope-mongodb
anousss007/blatui
zatona-eg/zatona-eg-api
cocosmos/filament-sticky-save-bar
patrickbussmann/oauth2-apple
3brs/enterprise-security-bundle
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat