This is a small package that can helps in debugging api logs. It can log request method, url, duration, request payload, which models are retrieved, controller and method.
-
In composer.json "require": { .... "espe-org/apilogger":"*" }, "repositories": [ { "type": "vcs", "url": "https://github.com/espe-org/apilogger" } ]
-
Publish the config file with:
php artisan vendor:publish --tag=config --provider="AWT\Providers\ApiLogServiceProvider"
You can also configure which fields should not be logged like passwords, secrets, etc.
You dont need to migrate if you are just using file driver
php artisan migrate
- Add middleware named apilogger to the route or controller you want to log data
//in route.php or web.php
Route::middleware('apilogger')->post('/test',function(){
return response()->json("test");
});
- Dashboard can be accessible via yourdomain.com/apilogs
You can permenently clear the logs by using the following command.
php artisan apilog:clear
From copy example/Apilogs to you app In apilog.php edit driver to \App\Apilogs\RESTLogger::class
The MIT License (MIT). Please see License File for more information.