wizbii/uptimerobot-php-sdk

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

a simple PHP SDK to use UptimeRobot API

1.0.0 2023-03-30 09:49 UTC

This package is auto-updated.

Last update: 2024-04-30 00:45:59 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