1. Go to this page and download the library: Download prgtw/healthchecks-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
prgtw / healthchecks-bundle example snippets
public function registerBundles()
{
$bundles = [
// ...
new prgTW\HealthchecksBundle(),
// ...
];
// ...
}
$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']);
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'];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.