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
Requires
- php: ^8.0
- laravel/framework: ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0
README
A simple Laravel package to log API requests and responses.
Installation
You can install the package via composer:
composer require debugged/apilogger
Configuration
- Publish the migration:
php artisan vendor:publish --provider="debugged\ApiLogger\ApiLoggerServiceProvider" --tag="migrations"
- Run the migrations:
php artisan migrate
- Add the middleware to your
app/Http/Kernel.phpfile in the$middlewareGroupsarray:
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).