1. Go to this page and download the library: Download apinator/apinator-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/ */
apinator / apinator-php example snippets
use Apinator\Apinator;
$client = new Apinator(
appId: 'your-app-id',
key: 'your-app-key',
secret: 'your-app-secret',
cluster: 'eu', // or 'us'
);
// Trigger an event
$client->trigger(
name: 'new-message',
data: json_encode(['text' => 'Hello!']),
channel: 'chat-room',
);
use Apinator\Apinator;
$client = new Apinator(
appId: 'your-app-id',
key: 'your-app-key',
secret: 'your-app-secret',
cluster: 'eu', // or 'us'
);
// In your auth route handler:
$socketId = $_POST['socket_id'];
$channelName = $_POST['channel_name'];
$auth = $client->authenticateChannel($socketId, $channelName);
header('Content-Type: application/json');
echo json_encode($auth);
use Apinator\Apinator;
$client = new Apinator(
appId: 'your-app-id',
key: 'your-app-key',
secret: 'your-webhook-secret',
cluster: 'eu', // or 'us'
);
$headers = getallheaders();
$body = file_get_contents('php://input');
try {
$client->verifyWebhook($headers, $body, maxAge: 300);
// Webhook is valid — process the payload
$payload = json_decode($body, true);
} catch (\Apinator\Errors\ValidationException $e) {
http_response_code(401);
echo 'Invalid webhook';
}
// List all channels
$channels = $client->getChannels();
// Filter by prefix
$presenceChannels = $client->getChannels(prefix: 'presence-');
// Get info about a specific channel
$info = $client->getChannel('presence-chat');
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.