wizbii/uptimerobot-php-sdk

There is no license information available for the latest version (1.1.0) of this package.

a simple PHP SDK to use UptimeRobot API

1.1.0 2024-07-15 13:47 UTC

This package is auto-updated.

Last update: 2024-11-15 14:33:00 UTC


README

This library provides an API Client for UptimeRobot API.

Installation

composer require wizbii/uptimerobot-php-sdk

Usage

Basic

$apiKey = "abcd"; // replace it with your own key
$client = new \Wizbii\UptimeRobotPHPSDK\UptimeRobotHttpClient($apiKey);
$monitors = $client->getAllMonitors();

Symfony

# .env
UPTIMEROBOT_APIKEY=abcd
# config/services.yaml
parameters:
    uptimerobot.apikey: '%env(UPTIMEROBOT_APIKEY)%'
    env(UPTIMEROBOT_APIKEY): 'abcd'

services:
    Wizbii\UptimeRobotPHPSDK\UptimeRobotHttpClient:
        arguments:
              $apiKey: '%uptimerobot.apikey%'
# any services like a controller
namespace App\Controller;

use Wizbii\UptimeRobotPHPSDK\UptimeRobotHttpClient;

class MyController
{
    public function __construct(
        private readonly UptimeRobotHttpClient $uptimeRobotHttpClient
    ) {}
    
    public function myFunction(): void
    {
        $monitors = $this->uptimeRobotHttpClient->getAllMonitors();
        // do something
    }
}

API Methods

All API methods are documented and strongly typed in Wizbii\UptimeRobotPHPSDK\UptimeRobotHttpClient

Contribute

Steps :

  • clone or fork the repository
  • create a branch
  • do your development
  • check that everything is fine using composer dev:checks
  • create a Merge Request