PHP API Quick Start

Installation

Make sure you have composer installed.

Install it directly:

composer require scaledrone/scaledrone

Or add the following to your composer.json:

{
    "require": {
        "scaledrone/scaledrone": "*"
    }
}

Then update your dependencies:

php composer.phar update

Usage

Create a new instance of Scaledrone client passing it the channel_id and secret_key that you can find from your channel's page from Scaledrone's dashboard.

$auth = array(
  'channel_id' => 'CHANNEL_ID',
  'secret_key' => 'SECRET_KEY'
);

$client = ScaleDrone\Client::create($auth);

Sending messages

Rooms are used to isolate different message types. To listen to messages, you need to subscribe to a specific room.
Users can freely connect to multiple rooms (this does not create extra connections).

$room = 'notifications';
$message = ['email' => 'test@foo.bar', 'name' => 'php name'];
$response = $client->publish($room, $message);