PHPackages                             yxs/apilogger - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. yxs/apilogger

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

yxs/apilogger
=============

Small laravel package for viewing api logs which can be used in debugging.

01PHP

Since Mar 19Pushed 2y agoCompare

[ Source](https://github.com/heartshuai/apilogger)[ Packagist](https://packagist.org/packages/yxs/apilogger)[ RSS](/packages/yxs-apilogger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

API Logger
==========

[](#api-logger)

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.

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

[](#installation)

1. Install the package via composer

```
composer require yxs/apilogger @dev
```

Usage
-----

[](#usage)

1. Laravel 5.5 and higher uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider. If you use a lower version of Laravel you must register it in your *app.php* file:

```
YXS\Providers\ApiLogServiceProvider::class
```

2. Publish the config file with:

```
php artisan vendor:publish --tag=config --provider="YXS\Providers\ApiLogServiceProvider"
```

The config file is called *apilogs.php*. Currently supported drivers are *db* and *file*

By default the logger will use *file* to log the data. But if you want to use Database for logging, migrate table by using

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
```

3. 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");
});
```

4. Dashboard can be accessible via ***yourdomain.com/apilogs***

Clear the logs
--------------

[](#clear-the-logs)

You can permenently clear the logs by using the following command.

```
php artisan apilog:clear
```

Implement your own log driver
-----------------------------

[](#implement-your-own-log-driver)

1. Your driver class ***must*** implement ApiLoggerInterface for saving, retrieving and deleting the logs.
2. Your driver class may extends `AbstractLogger` class which provide helpful methods such as logData and mapArrayToModel.
3. Substitude in your new class name instead of `db` or `file` as the driver. eg: `\App\Apilogs\CustomLogger::class`

Security
--------

[](#security)

### Add Auth

[](#add-auth)

In config/apilog.php you have 'route' option, you can change the prefix and add auth middleware or any other middleware

```
'route'          => [
    'prefix'     => 'apilogs',
    'middleware' => null,//Can be change to ['auth'] or others
]
```

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e897d052fe4196438d40019521274a50c11b2fc3e37499f7dd245dc600d4713?d=identicon)[heartshuai](/maintainers/heartshuai)

---

Top Contributors

[![aungwinthant](https://avatars.githubusercontent.com/u/17741172?v=4)](https://github.com/aungwinthant "aungwinthant (12 commits)")[![lloy0076](https://avatars.githubusercontent.com/u/1174532?v=4)](https://github.com/lloy0076 "lloy0076 (7 commits)")[![dansleboby](https://avatars.githubusercontent.com/u/4716382?v=4)](https://github.com/dansleboby "dansleboby (7 commits)")[![JohnRoux](https://avatars.githubusercontent.com/u/4610241?v=4)](https://github.com/JohnRoux "JohnRoux (2 commits)")[![bienvenu007](https://avatars.githubusercontent.com/u/51967788?v=4)](https://github.com/bienvenu007 "bienvenu007 (2 commits)")[![jacow](https://avatars.githubusercontent.com/u/1515728?v=4)](https://github.com/jacow "jacow (1 commits)")[![mikeerickson](https://avatars.githubusercontent.com/u/183153?v=4)](https://github.com/mikeerickson "mikeerickson (1 commits)")[![setkyar](https://avatars.githubusercontent.com/u/4435358?v=4)](https://github.com/setkyar "setkyar (1 commits)")[![t1sh0o](https://avatars.githubusercontent.com/u/3911728?v=4)](https://github.com/t1sh0o "t1sh0o (1 commits)")

### Embed Badge

![Health badge](/badges/yxs-apilogger/health.svg)

```
[![Health](https://phpackages.com/badges/yxs-apilogger/health.svg)](https://phpackages.com/packages/yxs-apilogger)
```

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)

PHPackages © 2026

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