robertogallea/pulse-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

robertogallea/pulse-api

最新稳定版本:1.0.3

Composer 安装命令:

composer require robertogallea/pulse-api

包简介

Add an API layer to Laravel Pulse metrics

README 文档

README

This package provides the very same information from Laravel Pulse as a JSON api endpoint.

17320370610423445938023068352330

Installation

You can install the package via composer:

composer require robertogallea/pulse-api

Usage

The package adds api endpoints to your application that exposes metrics collected by Pulse.

  • /api/pulse - Provides the full set of metrics collected by Pulse
  • /api/pulse/{$type} - Provides the metrics from a single type

By default, the available types are the one provided by Pulse itself:

  • servers
  • usage
  • queues
  • cache
  • slow_queries
  • exceptions
  • slow_requests
  • slow_jobs
  • slow_outgoing_requests

However, you can integrate your own by mimicking any Pulse card or by using your own implementation.

Configuration

The file config/pulse-api.php defines the configuration and can be customized after publishing the package Service Provider.

php artisan vendor:publish --tag=pulse-api-config

Access to endpoints

The endpoint is allowed according to the logic defined by the middlewares defined in the middleware section of the config. By default, the following apply:

'middleware' => [
    'api',
    Authorize::class, // the default Pulse middleware
],

Custom resources

Like in the web version of Pulse you can add your Cards, in PulseAPI you can add your own Resources, you can integrate the default ones by editing the resources configuration section:

'resources' =>
    \Robertogallea\PulseApi\Services\PulseAPI::getDefaultResources()->merge([
        // Add your custom resources
    ])->toArray(),

Including recorders configuration in json response

Laravel Pulse cards use configuration to adjust the rendering of the card view. This may be not required or not useful in api but is enabled by default. You can disable the configuration exposure by proper setting of the include-config configuration key to false:

'include_config' => env('PULSE_API_INCLUDE_CONFIG', true),

Changelog

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

Credits

License

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

统计信息

  • 总下载量: 5.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 38
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 38
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

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