1. Go to this page and download the library: Download api-video/statuspage-php 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/ */
api-video / statuspage-php example snippets
use ApiVideo\StatusPage\Client;
$client = new Client('2c04e0b2-8c4a-b941-de65-012a61b7f6ea'); // User API key
foreach ($client->components as $component) {
echo $component->id.': '.$component->name."\n";
}
$client->components->setStatus('7mst16b00d59', 'partial_outage');
foreach ($client->metrics as $metric) {
echo $metric->id.': '.$metric->name."\n";
}
$client->metrics->addPoint('gu1kkk8qe0dl', 12.5);
use ApiVideo\StatusPage\Client;
$client = new Client(
'2c04e0b2-8c4a-b941-de65-012a61b7f6ea', // User API key
[
'page-id' => 'zujkhu4kgivg', // (optional) Default page ID
]
);
// You can also set the default page later.
$client->setDefaultPageId('zujkhu4kgivg');
use ApiVideo\StatusPage\Client;
use ApiVideo\StatusPage\Model\Component;
$client = new Client(/*..*/);
foreach ($client->components as $component) {
// Available properties:
echo $component->id;
echo $component->name;
echo $component->description;
echo $component->created_at;
echo $component->status;
echo $component->updated_at;
echo $component->group;
echo $component->group_id;
echo $component->automation_email;
echo $component->only_show_if_degraded;
echo $component->page_id;
echo $component->position;
echo $component->showcase;
}
$component = $client->components->create([
'name' => 'Component name',
'description' => 'This is an example component',
]);
echo $component->id; // a5xc8i1a03ki
$component = $client->components->update('a5xc8i1a03ki', ['description' => 'Another description']);
$component = $client->components->setStatus('a5xc8i1a03ki', Component::STATUS_MAINTENANCE); // Avoid using magic strings
$client->components->delete('a5xc8i1a03ki');