1. Go to this page and download the library: Download checkitonus/cachet-api 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/ */
checkitonus / cachet-api example snippets
use CheckItOnUs\Cachet\Server;
$server = new Server([
'api_key' => 'API-KEY',
'base_url' => 'https://demo.cachethq.io', // The base URL for the Cachet installation
]);
// Should return pong
echo $server->ping();
use CheckItOnUs\Cachet\Server;
use CheckItOnUs\Cachet\Component;
$server = new Server([
'api_key' => 'API-KEY',
'base_url' => 'https://demo.cachethq.io', // The base URL for the Cachet installation
]);
// Find a component based on the name
$component = Component::on($server)->findByName('API');
// Find a component based on the ID
$component = Component::on($server)->findById(1);
// Find all components
Component::on($server)->all();
use CheckItOnUs\Cachet\Server;
use CheckItOnUs\Cachet\Component;
$server = new Server([
'api_key' => 'API-KEY',
'base_url' => 'https://demo.cachethq.io', // The base URL for the Cachet installation
]);
// Fluent API
$component = (new Component($server))
->setName('Name Here')
->setStatus(Component::OPERATIONAL)
->create();
use CheckItOnUs\Cachet\Server;
use CheckItOnUs\Cachet\Component;
$server = new Server([
'api_key' => 'API-KEY',
'base_url' => 'https://demo.cachethq.io', // The base URL for the Cachet installation
]);
// Fluent API
Component::on($server)
->findById(1)
->setName('Name Here')
->setStatus(Component::OPERATIONAL)
->update();
use CheckItOnUs\Cachet\Server;
use CheckItOnUs\Cachet\Component;
$server = new Server([
'api_key' => 'API-KEY',
'base_url' => 'https://demo.cachethq.io', // The base URL for the Cachet installation
]);
// Fluent API
Component::on($server)
->findById(1)
->delete();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.