gouh/psr-health 问题修复 & 功能扩展

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

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

gouh/psr-health

Composer 安装命令:

composer require gouh/psr-health

包简介

It is a handler to be able to know if there are certain connections such as cache, database and some external endpoints

README 文档

README

It is a handler to be able to know if there are certain connections such as cache, database and some external endpoints

Built With

Config

If you use config aggregator add next line in the array

PsrHealth\ConfigProvider::class

If you use only psr container add next line in your factories

\PsrHealth\Health::class => \PsrHealth\HealthFactory::class

Config for psr-health, add an array like this in the project config

    'health' => [
        'mongo' => [
            'host' => 'local-mongo-44',
            'port' => 27017,
            'database' => 'local',
            'collection' => 'startup_log',
            'user' => 'admin',
            'password' => 'admin'
        ],
        'mysql' => [
            'host' => 'local-mysql-57',
            'port' => 3306,
            'database' => 'credit',
            'user' => 'hangouh',
            'password' => 'secret2'
        ],
        'redis' => [
            'host' => 'local-redis',
            'port' => 6379,
            'password' => 'password'
        ],
        'endpoint' => [
            'webhook' => [
                'url' => 'https://webhook.site/e8dc7d50-6985-4345-81d1-b45c30601403',
                'custom_headers' => [
                    'Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l'
                ]
            ],
            'hangouh' => 'https://hangouh.me'
        ]
    ]

You can confgure only what you require

    'health' => [
        'mysql' => [
            'host' => 'local-mysql-57',
            'port' => 3306,
            'database' => 'credit',
            'user' => 'hangouh',
            'password' => 'secret2'
        ],
        'redis' => [
            'host' => 'local-redis',
            'port' => 6379,
            'password' => 'password'
        ]
    ]

Usage

Get Health class from your container and inject in your class

$health = $container->get(Health::class);

The class has multiple connection tests you can use each one or together

$health->redisConnection();
$health->mysqlConnection();
$health->mongoConnection();
$health->endpointConnection();
# Or you can use
$health->getHealthStatus();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固