2017 © Pedro Peláez
 

library phpcent

Php library to communicate with Centrifugo/Centrifuge)

image

gbksoft/phpcent

Php library to communicate with Centrifugo/Centrifuge)

  • Wednesday, October 25, 2017
  • by gbksoft
  • Repository
  • 3 Watchers
  • 1 Stars
  • 866 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 6 Versions
  • 40 % Grown

The README.md

Phpcent

Php library to communicate with Centrifugo HTTP API., (*1)

Library is published on the Composer: https://packagist.org/packages/sl4mmer/phpcent, (*2)

{
    "require": {
        "gbksoft/phpcent":"~1.0.5",
    }
}

Full Centrifugo documentation, (*3)

Basic Usage:, (*4)


$client = new \phpcent\Client("http://localhost:8000"); $client->setSecret("secret key from Centrifugo"); $client->publish("main_feed", ["message" => "Hello Everybody"]); $history = $client->history("main_feed");

You can use phpcent to create frontend token:, (*5)

    $token = $client->setSecret($pSecret)->generateClientToken($user, $timestamp);

Or to create private channel sign:, (*6)

    $sign = $client->setSecret($pSecret)->generateClientToken($client, $channel);

Since 1.0.3 phpcent has broadcast implementation., (*7)

$client->broadcast(['example:entities', 'example:moar'], ['user_id' => 2321321, 'state' => '1']);

SSL

In case if your Centrifugo server has invalid SSL certificate, you can use:, (*8)

\phpcent\Transport::setSafety(\phpcent\Transport::UNSAFE);

Since 1.0.5 you can use self signed certificate in safe manner:, (*9)

$client = new \phpcent\Client("https://localhost:8000");
$client->setSecret("secret key from Centrifugo");
$transport = new \phpcent\Transport();
$transport->setCert("/path/to/certificate.pem");
$client->setTransport($transport);

Note: Certificate must match with host name in Client address (localhost in example above)., (*10)

Alternative clients

The Versions

25/10 2017

dev-master

9999999-dev https://github.com/centrifugal/phpcent

Php library to communicate with Centrifugo/Centrifuge)

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

centrifugo

25/10 2017

1.0.5

1.0.5.0 https://github.com/centrifugal/phpcent

Php library to communicate with Centrifugo/Centrifuge)

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

centrifugo

29/02 2016

1.0.4

1.0.4.0 https://github.com/centrifugal/phpcent

Php library to communicate with Centrifugo/Centrifuge)

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

centrifugo

28/02 2016

1.0.3

1.0.3.0 https://github.com/centrifugal/phpcent

Php library to communicate with Centrifugo/Centrifuge)

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

centrifugo

07/07 2015

0.6.1

0.6.1.0 https://github.com/sl4mmer/phpcent

Php library to communicate with Centrifuge

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

centrifuge

15/06 2015

0.5.0

0.5.0.0 https://github.com/sl4mmer/phpcent

Php library to communicate with Centrifuge

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

centrifuge