1. Go to this page and download the library: Download hetao29/phpcent2 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/ */
hetao29 / phpcent2 example snippets
{
" "hetao29/phpcent2":"dev-master",
}
}
//to backend api
$client = new \phpcent2\Client("http://localhost:8000");
$client->setApikey("api key from Centrifugo");//to backend api
$client->publish("main_feed", ["message" => "Hello Everybody"]);
$history = $client->history("main_feed");
//to get token
$client->setSecret("secret key from Centrifugo");
$token = $client->getToken([
"data"=>[],
"sub"=>1
]);
$client = new \phpcent2\Client("https://localhost:8000");
$client->setSecret("secret key from Centrifugo");
$transport = new \phpcent2\Transport();
$transport->setCert("/path/to/certificate.pem");
$client->setTransport($transport);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.