PHPackages                             lupka/laravel-api-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. lupka/laravel-api-logger

ActivePackage[Logging &amp; Monitoring](/categories/logging)

lupka/laravel-api-logger
========================

Logs requests/responses inside your app via middleware.

0.1.0(6y ago)1111MITPHPPHP ^7.2

Since Jan 22Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lupka/laravel-api-logger)[ Packagist](https://packagist.org/packages/lupka/laravel-api-logger)[ RSS](/packages/lupka-laravel-api-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (1)

Log API requests/responses inside your Laravel app
==================================================

[](#log-api-requestsresponses-inside-your-laravel-app)

By default, this package logs the following data:

- Method (`GET`, `POST`, etc)
- URL
- Client IP Address
- Client User Agent
- Request Body
- Request Query Parameters
- User ID (for authenticated requests)
- HTTP Status Code (`200`, `404`, etc)
- Response Body (if JSON)
- Exception Type/Message if an error occurs

for each route where the middleware is installed.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require lupka/laravel-api-logger
```

The package will automatically register its service provider.

Then run the migration to add the `api_logs` table to your database:

```
php artisan migrate
```

Publish the config file (`api_logger.php`):

`php artisan vendor:publish --provider="Lupka\ApiLogger\ApiLoggerServiceProvider" --tag="config"`

Now you can install the `api-logger` middleware as needed. For example, in `app/Http/Kernel.php` (to log every API request):

```
protected $middlewareGroups = [
    ...
    'api' => [
        ...
        'api-logger',
    ],
];
```

Or, you can add the alias to a specific route or group:

```
Route::post('/test', 'TestController@test')->middleware('api-logger');
```

Viewing Logs
------------

[](#viewing-logs)

Logs are stored in the `api_logs` table. There's an Eloquent model included in the package (`Lupka\ApiLogger\Models\ApiLog`) for querying records, etc. For example, to get all logs:

```
Lupka\ApiLogger\Models\ApiLog::all();
```

Clearing Logs
-------------

[](#clearing-logs)

Logs can be cleared by scheduling the `api-logger:clear` job in your `app/Console/Kernel.php` file:

```
protected function schedule(Schedule $schedule)
{
    ...
    $schedule->command('api-logger:clear')->daily();
}
```

Any logs older than 30 days will be cleared by default. This can be changed by modifying the `log_expiry` config value.

Log -&gt; User Relationship
---------------------------

[](#log---user-relationship)

The `ApiLog` Eloquent model contains a relationship (`$log->user()`) with the default `App\User` model. If your user model has a different class name, you can change that relationship using the `user_class` config value.

License
-------

[](#license)

Licensed under the MIT license. See [License File](LICENSE) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/167d42f2db5d35f54d08ffd931b4fd48fd7f38dcc11d26b0b85d2cdcfbff9f1a?d=identicon)[lupka](/maintainers/lupka)

---

Top Contributors

[![lupka](https://avatars.githubusercontent.com/u/852553?v=4)](https://github.com/lupka "lupka (28 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lupka-laravel-api-logger/health.svg)

```
[![Health](https://phpackages.com/badges/lupka-laravel-api-logger/health.svg)](https://phpackages.com/packages/lupka-laravel-api-logger)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
