定制 shoesten-tag/log-http 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shoesten-tag/log-http

最新稳定版本:v0.1.1

Composer 安装命令:

composer require shoesten-tag/log-http

包简介

Log HTTP requests and responses in Laravel applications using PHP attributes

README 文档

README

Log HTTP requests and responses in Laravel applications using PHP attributes.

How to install

composer require shoesten-tag/log-http --dev

Notes

  • The default setting for both request and response logging is false. You can enable both by setting them to true or enable only one of them as needed.

  • Currently, logging is done only in the Laravel log file. However, if you change the logging channel, logs will be sent to the specified channel instead.

  • Not recommended for production use!

How to use

Add middleware to your routes

//Example
Route::resource('/dashboard', DashboardController::class)->middleware('log-http');

Log the response within the method

  #[Intercept(response: true)]
    public function index(){
        return new Collection(Employee::all());
    }

Log the request within the method

  #[Intercept(request: true)]
    public function index(){
        return new Collection(Employee::all());
    }

Enable logging of requests and responses within the class

#[Intercept(request: true, response: true)]
class EmployeeController extends Controller
{
     public function index(){
        return new Collection(Employee::all());
    }
}

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-03