Download the PHP package / without Composer

On this page you can find all versions of the php package /. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

ORTC-PHP (PHP API Client for Realtime.co)

Build Status

Real-time Framework - ORTC

It's an unofficial client for ORTC (Open Real-Time Connectivity, realtime & cloud-based pub/sub framework from realtime.co for PHP 5.4+), but yet powerful, composer based and compatible with psr-1, psr-2 and psr-4.

Installation

Using composer, install this package by running this command:

Configuration

Get Application Key & Private Key

First of all, you should register on realtime.co and get your api keys.

Ortc Config

Before you can call any api call, you should set your credentials.

$ortcConfig = new \Nikapps\OrtcPhp\Configs\OrtcConfig();

$ortcConfig->setApplicationKey('YOUR_APPLICATION_KEY'); //you application key
$ortcConfig->setPrivateKey('YOUR_PRIVATE_KEY'); //Your private key
$ortcConfig->setVerifySsl(true); //verify ssl/tls certificate

Done!

Usage

Get Balancer URL (Manually)

This package automatically get balancer url (best available server), but if you want fetch a new balancer url manually:

$ortc = new \Nikapps\OrtcPhp\Ortc($ortcConfig);

$balancerUrl = $ortc->getBalancerUrl();

echo 'Balancer Url: ' . $balancerUrl->getUrl();

Authentication

In order to authenticate a user:

First, you should create your channels:

$channelOne = new \Nikapps\OrtcPhp\Models\Channel();
$channelOne->setName('CHANNEL_ONE_NAME');
$ChannelOne->setPermission(Channel::PERMISSION_WRITE);

$channelTwo = new \Nikapps\OrtcPhp\Models\Channel();
$channelTwo->setName('CHANNEL_TWO_NAME');
$channelTwo->setPermission(Channel::PERMISSION_READ);

$channels = [
    $channelOne,
    $channelTwo
];

Then authenticate the user:


$authToken = 'YOUR_AUTH_TOKEN'; //your authentication token

$authRequest = new \Nikapps\OrtcPhp\Models\Requests\AuthRequest();
$authRequest->setAuthToken($authToken);
$authRequest->setExpireTime(5 * 60); //token ttl (expiration time) in seconds
$authRequest->setPrivate(true); //Indicates whether the authentication token is private
$authRequest->setChannels($channels);

$ortc = new \Nikapps\OrtcPhp\Ortc($ortcConfig);
$ortc->authenticate($authRequest);

Send Message (Push)

In order to push a message to a channel:

$authToken = 'YOUR_AUTH_TOKEN'; //your authentication token

$sendMessageRequest = new \Nikapps\OrtcPhp\Models\Requests\SendMessageRequest();
$sendMessageRequest->setAuthToken($authToken);
$sendMessageRequest->setChannelName('CHANNEL_NAME');
$sendMessageRequest->setMessage('YOUR_MESSAGE');

$ortc = new \Nikapps\OrtcPhp\Ortc($ortcConfig);
$ortc->sendMessage($sendMessageRequest);

If you using UTF-8 messages, it's better to use base64_encode().

Exceptions

Parent of other exceptions

When token is expired or credentials are invalid

When balancer url is invalid

-You can get url by getUrl()

When at least one message response is failed

-You can get all results by getResults(). It returns a \GuzzleHttp\BatchResults object.

Guzzle ClientExcpetion

-You can get guzzle exception by getClientException()

Dependencies

Ortc Documentation

This package is based on ORTC REST API. You can download REST service documentation from this url:

Also, you can download official ORTC library for PHP from this url:

Framework Integrations

TODO

Contribute

Wanna contribute? simply fork this project and make a pull request!

License

This project released under the MIT License.

Donation

Donate via Paypal


All versions of with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
guzzlehttp/guzzle Version ~5.2
ramsey/uuid Version ^3.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package / contains the following files

Loading the files please wait ....