cmzz / laravel-request-id by cmzz

RequestId middleware for Laravel;
246
1
2
Package Data
Maintainer Username: cmzz
Maintainer Contact: me19@qq.com (wuzhuo)
Package Create Date: 2017-04-28
Package Last Update: 2017-04-28
Language: PHP
License: MIT
Last Refreshed: 2024-11-18 03:03:14
Package Statistics
Total Downloads: 246
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

laravel-request-id

为请求生成唯一 id 的 laravel 中间件

安装

composer require cmzz/laravel-request-id

使用

  • app\Http\Kernel.php 文件的 $routeMiddleware 数组中添加:

    'request.id' => \Cmzz\RequestId\Middleware\RequestIdMiddleware::class

  • 加载中间件

    public function __construct() { $this->middleware('request.id'); }

  • 获得id

    public function index(Request $request) { dd($request->requestId); }