PHPackages                             zyan/laravel-logs - 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. zyan/laravel-logs

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

zyan/laravel-logs
=================

一个记录laravel用户请求的日志中间件

2.1.1(4y ago)014.5kMITPHPPHP &gt;=7.2

Since Jun 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/aa24615/laravel-logs)[ Packagist](https://packagist.org/packages/zyan/laravel-logs)[ RSS](/packages/zyan-laravel-logs/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelogDependencies (6)Versions (10)Used By (0)

zyan/laravel-logs
=================

[](#zyanlaravel-logs)

一个记录laravel用户请求的日志中间件

要求
--

[](#要求)

1. php &gt;= 7.2
2. Composer

安装
--

[](#安装)

```
composer require zyan/laravel-logs -vvv
```

配置
--

[](#配置)

然后去 `config/logging.php` 配置日志通道

```
return [
    //...
    'request' => [
        'enabled' => true, //是否启用
        'channel' => ['stack'], //通道
        'environment' => ['local','testing'] //环境
    ]
];
```

中间件
---

[](#中间件)

请在 `app/Http/Kernel.php` 中添加默认的中间件

```
namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Zyan\LaravelLogs\Middleware\RequestLogs; //使用默认中间件

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        RequestLogs::class, //全局使用
        //...
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            RequestLogs::class, //在web中使用
            //...
        ],

        'api' => [
            RequestLogs::class, //在api中使用
            //...
        ],
    ];
    //...
}
```

自定义
---

[](#自定义)

自已手动添加一个中间件

```
namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Log;
use Zyan\LaravelLogs\Logs;

class RequestLogs
{
    public function handle($request, Closure $next)
    {
        $response = $next($request);

        try {
            $logs = new Logs();
            $logs->request()->response($response)->write();
            //按需配置你需要记录的信息
            //->request() 记录请求信息s
            //->response($response) 记录返回日志
            //->write() 执行写入
        }catch (\Exception $e){
            Log::error($e->getMessage().' '.$e->getFile().":".$e->getLine());
        }

        return $response;
    }
}
```

暂不支持sql日志 需要记录sql查询移步

参与贡献
----

[](#参与贡献)

1. fork 当前库到你的名下
2. 在你的本地修改完成审阅过后提交到你的仓库
3. 提交 PR 并描述你的修改，等待合并

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~37 days

Recently: every ~58 days

Total

9

Last Release

1501d ago

Major Versions

1.0.4 → 2.02022-04-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbcdf7ec634eb735375fa4f6046f91646934f9eb07456f4b4dcbdec545c6435b?d=identicon)[aa24615](/maintainers/aa24615)

---

Top Contributors

[![aa24615](https://avatars.githubusercontent.com/u/33275679?v=4)](https://github.com/aa24615 "aa24615 (19 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/zyan-laravel-logs/health.svg)

```
[![Health](https://phpackages.com/badges/zyan-laravel-logs/health.svg)](https://phpackages.com/packages/zyan-laravel-logs)
```

###  Alternatives

[overtrue/laravel-query-logger

A dev tool to log all queries for laravel application.

413307.5k6](/packages/overtrue-laravel-query-logger)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[regulus/activity-log

A clean and simple Laravel 5 activity logger for monitoring user activity on a website or web application.

164220.1k2](/packages/regulus-activity-log)

PHPackages © 2026

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