定制 kodamity/laravel-api-usage-pulse 二次开发

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

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

kodamity/laravel-api-usage-pulse

最新稳定版本:v1.1.0

Composer 安装命令:

composer require kodamity/laravel-api-usage-pulse

包简介

API usage cards for Laravel Pulse

README 文档

README

Kodamity Logo

Requests Graph for Laravel Pulse

API usage cards for Laravel Pulse

Build Status Total Downloads Latest Stable Version License

This is package that adds API usage cards and recorders for Laravel Pulse.

Installation

You can install the package via composer:

composer require kodamity/laravel-api-usage-pulse

Recorders

Add recorders configuration inside config/pulse.php. (If you don't have this file make sure you have published the config file of Laravel Pulse using php artisan vendor:publish --tag=pulse-config)

Requests Statistics recorder

Requests Statistics recorder records the number of requests and the number of successful requests in general for all users. And it records the number of requests and the number of successful requests for each user.

return [
    // ...
    
    'recorders' => [
        // Existing recorders...
        
        \Kodamity\Libraries\ApiUsagePulse\Recorders\RequestsStatistics::class => [
            'enabled' => env('PULSE_KDM_API_USAGE_REQUESTS_STATISTICS_ENABLED', true),
            'sample_rate' => env('PULSE_KDM_API_USAGE_REQUESTS_STATISTICS_SAMPLE_RATE', 1),
            'ignore' => [
                '#^/pulse$#', // Pulse dashboard...
            ],
        ],
    ],
];

Responses Statistics recorder

Responses Statistics recorder records the average response time and the number of responses by status code group for all users.

return [
    // ...
    
    'recorders' => [
        // Existing recorders...
        
        \Kodamity\Libraries\ApiUsagePulse\Recorders\ResponsesStatistics::class => [
            'enabled' => env('PULSE_KDM_API_USAGE_RESPONSES_STATISTICS_ENABLED', true),
            'sample_rate' => env('PULSE_KDM_API_USAGE_RESPONSES_STATISTICS_SAMPLE_RATE', 1),
            'ignore' => [
                '#^/pulse$#', // Pulse dashboard...
            ],
            'records' => [
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Informational->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Successful->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Redirection->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::ClientError->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::ServerError->value,
            ],
        ],  
    ],
];

Dashboards

To add the card to the Pulse dashboard, you must first publish the vendor view.

php artisan vendor:publish --tag=pulse-dashboard

Then, you can modify the dashboard.blade.php file and add the card to the dashboard.

<livewire:kodamity.pulse.api-usage.requests-summary cols="5" rows="2" />

<livewire:kodamity.pulse.api-usage.response-statuses-graph cols="7" />

<livewire:kodamity.pulse.api-usage.response-times-graph cols="7" />

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固