PHP SDK
An easy-to-use PHP package to communicate with the Oh Dear API from your own applications.
We've created an easy-to-use open source PHP package that allows you to communicate with the Oh Dear API. It provides convenient models and methods to quickly get started.
Installation #
Grab the latest stable version via composer:
composer require ohdearapp/ohdear-php-sdk
Getting Started #
Create an instance of the SDK with your API key:
$apiKey = "iK4YfZe2i1RAe22tKP4xejGKDZP...."; $ohDear = new OhDear\PhpSdk\OhDear($apiKey);
If you don't have an API key yet, read up on the API authentication first.
Quick Examples #
Get all monitors
$monitors = $ohDear->sites();
Add a new monitor
$ohDear->createSite([ 'url' => 'https://yourbrandnewsite.tld', 'team_id' => $yourTeamId ]);
Get uptime data
$ohDear->site($monitorId)->uptime($start, $end, $split);
Manage maintenance periods
// Start maintenance for 10 minutes $ohDear->site($monitorId)->startMaintenance(600); // Stop maintenance $ohDear->site($monitorId)->stopMaintenance();
Full Documentation #
For complete documentation covering all available methods including checks, broken links, certificate health, status pages, cron job monitoring, and more, visit the full SDK documentation.