atdev / rocket-chat
Rocket Chat REST API PHP Wrapper Library
Installs: 63 526
Dependents: 1
Suggesters: 0
Security: 0
Stars: 28
Watchers: 6
Forks: 16
Open Issues: 6
Requires
- php: >=5.6.0
- doctrine/collections: ^1.0 || ^2.0
- egulias/email-validator: >=2.0
- guzzlehttp/guzzle: ^6.0 || ^7.0
Requires (Dev)
- codeception/aspect-mock: ^4.0
- friendsofphp/php-cs-fixer: ^2.16
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-12-19 22:35:50 UTC
README
This is a wrapper for Rest API of Rocket Chat: https://developer.rocket.chat/reference/api/rest-api
Installation
This library is installed via Composer. You will need to require atdev/rocket-chat
:
composer require atdev/rocket-chat:~1.0
How to use
LOGIN
// Firstly, init \ATDev\RocketChat\Chat::setUrl("http://chat.me"); // No trailing / // Now, login $result = \ATDev\RocketChat\Chat::login("[USER LOGIN]", "[USER PASSWORD]"); if (!$result) { // Log the error $error = \ATDev\RocketChat\Chat::getError(); }
GET CURRENTLY LOGGED IN USER
$who = \ATDev\RocketChat\Chat::me(); if (!$who) { // Log the error $error = \ATDev\RocketChat\Chat::getError(); }
LOGOUT
\ATDev\RocketChat\Chat::logout();
Now, when you are logged in, you can:
Unit tests
Tests are run by ./vendor/bin/phpunit tests
. Although the library code is designed to be compatible with php 5.6
, testing
requires php 7.3
as minimum because of phpunit
version 9
.
PHP Code Fixer
PHP-CS-Fixer is used to fix automatically coding standard issues.
.php_cs.dist
is set to handle PSR-12 coding style.
To lint code against code style run ./vendor/bin/php-cs-fixer fix --verbose --show-progress=estimating --dry-run
.
To fix code styles automatically run above command without --dry-run
option.