PHP code example of hitslab / rocket-chat-sdk
1. Go to this page and download the library: Download hitslab/rocket-chat-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hitslab / rocket-chat-sdk example snippets
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();