Home
Softono

Scaledrone Php

Open source PHP
11
Stars
5
Forks
0
Issues
2
Watchers
8 years
Last Commit

 About Scaledrone Php

PHP API client for Scaledrone Realtime Messaging Service

Platforms

Web Self-hosted

Languages

PHP

Need Help Installing Scaledrone Php?

We provide expert installation service for this software. Our team will install, configure, and secure Scaledrone Php on your server. plans start at just $30.

Scaledrone Php

View on GitHub

ScaleDrone PHP

Official ScaleDrone PHP pushing library. This is a wrapper around the REST API.

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 passing it the channel_id and secret_key that you can find from the channel's page

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

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

If you wish to connect using a JSON Web Token you can set it like this:

$auth = array(
    'channel_id' => 'CHANNEL_ID',
    'bearer' => 'GENERATED_JWT'
);

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

Publishing a message

$room = 'notifications';
$message = ['email' => '[email protected]', 'name' => 'php name'];
$response = $client->publish($room, $message);

Channel stats

$response = $client->channel_stats();

Getting the complete list of users from all rooms

$response = $client->members_list();

Getting the list of users in a room

$response = $client->room_members_list('roomName');

Getting the list of rooms and their members

$response = $client->all_room_members_list('roomName');

Running Tests

Clone this repository and change directories to the repository root. Install all dependencies with composer install. Then, just run vendor/bin/phpunit.