承接 prgtw/healthchecks-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

prgtw/healthchecks-bundle

最新稳定版本:0.12.0

Composer 安装命令:

composer require prgtw/healthchecks-bundle

包简介

Bundle for integration with healthchecks.io cron monitoring service

README 文档

README

Dependency Status Packagist Packagist

Bundle enables integration with healthchecks.io.

TODO:

  • implement concurrent requests

Installation

  1. Require the prgtw/healthchecks-bundle package in your composer.json and update your dependencies.

    composer require prgtw/healthchecks-bundle
  2. Add the HealthchecksBundle to your application's kernel:

    public function registerBundles()
    {
    	$bundles = [
    		// ...
    		new prgTW\HealthchecksBundle(),
    		// ...
    	];
    	// ...
    }

Configuration

Example configuration:

healthchecks:
    api:
        clients:
            example: "api-key-here"
    timezone: "Europe/Warsaw" # default timezone to use for checks
    checks:
    	simple:
            client: example
            name: "Simple hourly check"
            timeout: 3600
            tags: [simple, all]
        cron:
            client: example
            name: "Cron-based check"
            schedule: "*/30 * * * *"
            timezone: UTC
            tags: [cron, all]

Usage

$api = $container->get('healthchecks.api');

// setup checks on healthchecks.io side according to configuration
$api->setup('simple');
$api->setupMany(['simple', 'cron']);

// ping check(s)
$api->ping('simple');
$api->pingMany(['simple', 'cron']);

// pause check(s)
$api->pause('simple');
$api->pauseMany(['simple', 'cron']);

Providing checks data at runtime

To provide checks data at runtime you have to create your own resolver, and you have to configure bundle to use this resolver instead of default one

For example:

namespace App\Healthchecks\Resolver;

use prgTW\HealthchecksBundle\Resolver\ResolverInterface;

class CustomResolver implements ResolverInterface
{
	public function resolve()
	{
		// Get the data from your source and map your array in such format: 
		return [
			'backup_task'  => [
				'name'     => 'Backup task',
				'schedule' => '15 2 * * *',
				'client'   => 'dev',
				'tags'     => ['backup', 'devops'],
				'unique'   => ['name', 'tags'],
			],
			'cleanup_task' => [
				'name'     => 'Cleanup task',
				'schedule' => '0 3 * * *',
				'client'   => 'dev',
				'tags'     => ['backup', 'devops'],
				'unique'   => ['name', 'tags'],
			],
		];
	}

	public function resolveNames(): array
	{
		return ['backup_task', 'cleanup_task'];
	}
}
services:
    healthchecks.resolver.custom:
        class: "App\\Healthchecks\\Resolver\\CustomResolver"
healthchecks:
    api:
        clients:
            example: "api-key-here"
    timezone: "Europe/Warsaw" # default timezone to use for checks
    resolver: "healthchecks.resolver.custom" #Service ID of your custom resolver 

统计信息

  • 总下载量: 208.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04