ninjacto/ortc-php

PHP SDK wrapper for ORTC (Realtime pub/sub framework from RealTime.co)

dev-master / 1.0.x-dev 2016-11-13 07:09 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:53:19 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A modern PHP client for ORTC (Open Real-Time Connectivity, realtime & cloud-based pub/sub framework from realtime.co for PHP 5.5+).

Install

Via Composer

$ composer require ninjacto/ortc-php

Usage

$ortcConfig = new OrtcConfig();
$ortcConfig->setApplicationKey('YOUR_APPLICATION_KEY');
$ortcConfig->setPrivateKey('YOUR_PRIVATE_KEY');
$ortcConfig->setVerifySsl(false);
$url = 'http://ortc-developers.realtime.co/server/2.1'; // ORTC server URL
$authToken = 'YOUR_AUTHENTICATION_TOKEN';
$channels = [];
$testChannel = new Channel();
$testChannel->setName('CHANNEL_NAME');
$testChannel->setPermission(Channel::PERMISSION_READ);
$channels[] = $testChannel;
$ortc = new Ortc($ortcConfig);
$authRequest = new AuthRequest();
$authRequest->setAuthToken($authToken);
$authRequest->setExpireTime(61);
$authRequest->setPrivate(true);
$authRequest->setChannels($channels);
$authResponse = $ortc->authenticate($authRequest);

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email ramin.farmani@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.