debugged/apilogger

A Laravel package for logging API requests and responses

Installs: 37

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/debugged/apilogger

2.0.0 2024-12-27 09:50 UTC

This package is auto-updated.

Last update: 2026-01-17 06:58:59 UTC


README

A simple Laravel package to log API requests and responses.

Installation

You can install the package via composer:

composer require debugged/apilogger

Configuration

  1. Publish the migration:
php artisan vendor:publish --provider="debugged\ApiLogger\ApiLoggerServiceProvider" --tag="migrations"
  1. Run the migrations:
php artisan migrate
  1. Add the middleware to your app/Http/Kernel.php file in the $middlewareGroups array:
protected $middlewareGroups = [
    'api' => [
        // ... other middleware
        \debugged\ApiLogger\Http\Middleware\APILog::class,
    ],
];

Usage

Once installed and configured, the package will automatically log all API requests and responses to the logs table. Each log entry includes:

  • HTTP method
  • URL
  • IP address
  • User agent
  • Request data
  • Response data
  • Status code
  • Timestamps

License

The MIT License (MIT).