2017 © Pedro Peláez
 

library serverdox-php

The Serverdox SDK provides methods for all API functions.

image

serverdox/serverdox-php

The Serverdox SDK provides methods for all API functions.

  • Wednesday, September 16, 2015
  • by adawoo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Serverdox-PHP

This is the Serverdox PHP SDK. This SDK contains methods for easily interacting with the Serverdox API. Below are examples to get you started. For additional examples, please see our official documentation at https://www.serverdox.com/api/docs, (*1)

Latest Stable Version, (*2)

Installation

To install the SDK, you will need to be using Composer in your project. If you aren't using Composer yet, it's really simple! Here's how to install composer and the Serverdox SDK., (*3)

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add Serverdox as a dependency
php composer.phar require serverdox/serverdox-php:~1.0

For shared hosts without SSH access, check out our Shared Host Instructions., (*4)

Rather just download the files? Library Download., (*5)

Next, require Composer's autoloader, in your application, to automatically load the Serverdox SDK in your project:, (*6)

require 'vendor/autoload.php';
use Serverdox\Serverdox;

Usage

Here's how to create a monitor using the SDK:, (*7)

# First, instantiate the SDK with your API credentials.
$serverdox = new Serverdox("api-key-here");

# Now, create your monitor.
$serverdox->monitors->create(array(
    "name"                      => "Google",
    "url"                       => "https://www.google.com",
    "monitor_server_location"   => "NYC",
    "notes"                     => "My notes about Google.",
    "contacts"                  => array(
        "contact-id-here" => array(
            "sms" => true
        )
    ),
    "me_contact"                => true
));

Or list the 2 most recent monitors created:, (*8)

# First, instantiate the SDK with your API credentials and define your domain. 
$serverdox = new Serverdox("api-key-here");

# Now, get the monitors.
$serverdox->monitors->all(array(
    'limit' => 2
));

Response

JSON will be returned in all responses from the API, including errors., (*9)

Example:, (*10)

$serverdox = new Serverdox("api-key-here");

$monitors = $serverdox->monitors->all(array(
    'limit' => 2
));

echo '

', print_r($monitors), '
';

Example Contents:
$monitors will contain JSON of the API response. In the above example, something like the following would be displayed:, (*11)

{
    "monitors": [
        {
            "id": "M_XXXXXXXXXXXXXXXX",
            "name": "Google",
            "url": "https://www.google.com",
            "monitor_server_location": "NYC",
            "current_status": "Pending",
            "notes": "My notes about Google.",
            "run": true,
            "contacts": [
                {
                    "me": false,
                    "C_XXXXXXXXXXXXXXXX": {
                        "email": false,
                        "sms": true,
                        "twitter": false
                    }

                }
            ],
            "created_at": 1420070401
        },
        {
            "id": "M_XXXXXXXXXXXXXXXX",
            "name": "Serverdox",
            "url": "https://www.serverdox.com",
            "monitor_server_location": "LON",
            "current_status": 200,
            "run": true,
            "contacts": [
                {
                    "me": true,
                },
                {
                    "me": false,
                    "C_XXXXXXXXXXXXXXXX": {
                        "email": true,
                        "sms": true,
                        "twitter": false
                    }
                }
            ],
            "created_at": 1420070400
        }
    ],
    "remaining": 3,
    "livemode": true
}

Testing

We aim to make testing our PHP SDK as simple as possible and the only change you need to make is to your API key., (*12)

To use the SDK in test mode simply put "test_" before your API key, e.g. "test_XXXXXXXXXXXXXXXX"., (*13)

In test mode most aspects of the API remain the same including account limits, API limits and errors. However, it is not possible to attach a test contact to a live monitor and vice versa. Trying to retrieve the logs of a monitor in test mode will return an error as this is also not possible in test mode., (*14)

Retrieving a test object via the API will have a JSON attribute: "livemode": false., (*15)

Support and Feedback

Be sure to visit the Serverdox official API documentation for additional information about our API., (*16)

If you find a bug, please submit the issue in Github directly. Serverdox-PHP Issues, (*17)

As always, if you need additional assistance, contact us at https://serverdox.com/contact., (*18)

The Versions

16/09 2015

dev-master

9999999-dev

The Serverdox SDK provides methods for all API functions.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Serverdox

16/09 2015

v1.0

1.0.0.0

The Serverdox SDK provides methods for all API functions.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Serverdox

16/09 2015

v0.7

0.7.0.0

The Serverdox SDK provides methods for all API functions.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Serverdox