Interface for StatusCake API

0.2.1 2019-12-09 10:11 UTC

This package is auto-updated.

Last update: 2023-03-09 17:17:05 UTC


#StatusCake API wrapper

StatusCake is a monitoring service that monitors website/servers over HTTP/TCP/PING.

This project wraps most endpoints StatusCake has to offer.


Via Composer

composer require happydemon/statuscake


Setting up the client:

$statusCake = new StatusCake\Client(`USER', 'TOKEN');

Checking if the credentials are valid:

$statusCake->validAccount(); // return true or false

Getting basic account info:



These are actually your monitors, each test would represent a website you're monitoring.

Each returned test will be parsed into a class StatusCake\Test, all the properties are documented in there, be sure to check it out.

Creating a test

To create a test you need to initialise StatusCake\Test. There are just a few properties that are actually required; websiteName, websiteURL, testType.

$test = new StatusCake\Test();

// Required parameters
$test->websiteName = 'HappyDemon';
$test->websiteURL = 'http://happydemon.xyz';
$test->testType = StatusCake\Test::TYPE_HTTP;

// I'm a little impatient, so I'd like more frequest checks (every 2 minutes)
$test->checkRate = 120;

// Save everything

Updating a test

Updating is done in the same way:

// I've changed my mind, let's check every 5 minutes
$test->checkRate = 300;

// Save the change

Deleting a test


Retrieving tests

Retrieving a list of existing tests is simple:

$tests = $statusCake->getTests();

Retrieving a test's period

A period of data is two time stamps in which status has remained the same.

$periods = $test->getPeriods();

Retrieving a test's performance data

Retrieves a list of checks performed for the current site (this statusCake users with a premium account).

$periods = $test->getPerformance();

Retrieve a test's previously sent alerts

Retrieves a list of alerts that have, previously, been sent.

$periods = $test->getAlerts();

Contact Groups

One of the properties tests could need assigned is contact groups. You can retrieve and manage them through the API as wel.

The same principles as Tests are applied here, meaning every contact group will be loaded in a StatusCake\ContactGroup class (check the class definition for more info on the properties).

A few helper functions are included to work with email addresses.

Creating a contact group

$contactGroup = new StatusCake\ContactGroup();

// The only required parameter
$contactGroup->groupName = 'personal mail';

// let's add an email to get notifications

// Save everything

Updating a contact group

// I've changed my mind, different email

// Which is the same as doing
$contactGroup->email = ['maxim@happydemon.xyz']

// Save everything

Deleting a contact group