PHP code example of marcosraudkett / centrifuge-php

1. Go to this page and download the library: Download marcosraudkett/centrifuge-php 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/ */

    

marcosraudkett / centrifuge-php example snippets


use Mvrc\CentrifugePhp\CentrifugeConnector;
use Mvrc\CentrifugePhp\Requests\PublishRequest;

$connector = new CentrifugeConnector;
$request = new PublishRequest(
    channel: "private-test",
    data: [
        "test" => true
    ]
);

$response = $connector->send($request);

print_r($response->json());
print_r($response->status());

composer