hitslab/rocket-chat-sdk

PHP SDK for Rocket.Chat REST API

v0.2.1 2020-10-18 19:48 UTC

This package is auto-updated.

Last update: 2024-05-19 04:14:08 UTC


README

Documentation for Rocket.Chat REST API available here - Rocket.Chat API

Install

composer require hitslab/rocket-chat-sdk

Example

use Hitslab\RocketChatSDK\RocketChatClient;
use Hitslab\RocketChatSDK\Request\Authentication\LoginRequest;
use Hitslab\RocketChatSDK\Request\Users\UsersListRequest;

// Creating client
$client = new RocketChatClient("https://rocket.my-company.org");

// Auth with login (or email) and password
$loginResponse = LoginRequest::create($client)
    ->user('username')
    ->password('password')
    ->request();

// Get list of users
$users = UsersListRequest::create($client)
    ->auth($loginResponse->data->authToken, $loginResponse->data->userId)
    ->request();