henrywhitaker3 / healthchecks-io
A simple PHP healthchecks.io wrapper
Installs: 121 040
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 1
Open Issues: 7
Requires
- php: >=7.2.5
- rakit/validation: ^1.3
- ramsey/uuid: ^4.1
Requires (Dev)
- phpstan/phpstan: ^0.12.37
- phpunit/phpunit: ^8.5
- vlucas/phpdotenv: ^5.1
This package is auto-updated.
Last update: 2024-11-22 08:44:48 UTC
README
This package provides simple methods to interact with the healthchecks.io API.
Installation
composer require henrywhitaker3/healthchecks-io
Usage
This package provides two classes you can use:
Healthchecks
This class is just used to update a healthchecks.io endpoint.
To create a new instance, you need to pass the UUID for the endpoint you want to update:
$hc = new Healthchecks('SAMPLE-UUID-HERE');
Once you have your created a new instance, there are 3 methods to use:
$hc->success(); // sends a 'success' signal $hc->fail(); // sends a 'fail' signal $hc->start(); // sends a 'start' signal
HealthchecksManager
This class can be used to interact with the healthchecks.io management API. Creating a new instance is simple:
$hm = new HealthchecksManager('SAMPLE-API-KEY');
You now have several methods you can use:
$hm->listChecks(); // lists all checks $hm->getCheck('UUID'); // get info for a specific check $hm->pauseCheck('UUID'); // pauses a check $hm->resumeCheck('UUID'); // pings a check to resume it $hm->deleteCheck('UUID'); // deletes the check $hm->getCheckPings('UUID'); // gets a list of pings for the check $hm->getCheckStatusChanges('UUID'); // returns a list of "flips" this check has experienced $hm->createCheck($args); // create a new check $hm->updateCheck('UUID', $args); // update an existing check $hm->integrations(); // get a list of integrations (i.e. slack, discord etc.)
Contributing
Contributions are welcome, but please write tests for whatever you add. Create a new file in the tests/tests
directory with the following structure:
<?php namespace Henrywhitaker3\Healthchecks\Tests; class NewTest extends Test { // }
As these tests will need valid credentials and a UUID, you will need to setup a .env
file to run tests successfully. Simply copy the .env.example
to .env
and fill in the relevant details.