PHPackages                             apinator/apinator-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. apinator/apinator-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

apinator/apinator-php
=====================

PHP server SDK for Apinator — trigger events, authenticate channels, verify webhooks

v1.0.2(3mo ago)08MITPHPPHP &gt;=8.1CI passing

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/apinator-io/sdk-php)[ Packagist](https://packagist.org/packages/apinator/apinator-php)[ Docs](https://github.com/apinator/sdk-php)[ RSS](/packages/apinator-apinator-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

apinator/apinator-php
=====================

[](#apinatorapinator-php)

[![Packagist Version](https://camo.githubusercontent.com/f203e81e7b9f2135a61c508baf435a61cbb028d89ec54a1fdb9779c95315d656/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170696e61746f722f6170696e61746f722d7068702e737667)](https://packagist.org/packages/apinator/apinator-php)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![CI](https://github.com/apinator-io/sdk-php/actions/workflows/test.yml/badge.svg)](https://github.com/apinator-io/sdk-php/actions/workflows/test.yml)

PHP server SDK for [Apinator](https://apinator.io) — trigger real-time events, authenticate channels, and verify webhooks.

Features
--------

[](#features)

- Trigger events on public, private, and presence channels
- Channel authentication (HMAC-SHA256)
- Webhook signature verification
- Channel introspection (list channels, get channel info)
- Zero external dependencies — PHP 8.1+ stdlib only
- Laravel integration guide included

Installation
------------

[](#installation)

```
composer require apinator/apinator-php
```

Quick Start
-----------

[](#quick-start)

```
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',
);
```

Channel Authentication
----------------------

[](#channel-authentication)

For private and presence channels, your backend must provide an auth endpoint:

```
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);
```

For presence channels, include channel data:

```
$channelData = json_encode([
    'user_id' => $currentUser->id,
    'user_info' => ['name' => $currentUser->name],
]);

$auth = $client->authenticateChannel($socketId, $channelName, $channelData);
```

Webhook Verification
--------------------

[](#webhook-verification)

```
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';
}
```

Channel Introspection
---------------------

[](#channel-introspection)

```
// 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');
```

API Reference
-------------

[](#api-reference)

See [docs/api-reference.md](docs/api-reference.md) for the full API.

Laravel Integration
-------------------

[](#laravel-integration)

See [docs/laravel.md](docs/laravel.md) for a step-by-step Laravel integration guide.

Links
-----

[](#links)

- [Installation Guide](docs/installation.md)
- [Quick Start Tutorial](docs/quickstart.md)
- [API Reference](docs/api-reference.md)
- [Laravel Integration](docs/laravel.md)
- [Architecture Guide](docs/architecture.md)
- [Contributing](CONTRIBUTING.md)
- [Changelog](CHANGELOG.md)

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance78

Regular maintenance activity

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

113d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cb48d47a9005711f9daa518ef3e9e5826eccc99e7b1a75c6a2c5e5f8f0f0e3c?d=identicon)[apinator-dev](/maintainers/apinator-dev)

---

Top Contributors

[![apinator-dev](https://avatars.githubusercontent.com/u/261807785?v=4)](https://github.com/apinator-dev "apinator-dev (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![toocool](https://avatars.githubusercontent.com/u/691250?v=4)](https://github.com/toocool "toocool (1 commits)")

---

Tags

laravelphpsymphonywebsockets-serversdkserverwebsocketrealtimepubsubchannelsapinator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apinator-apinator-php/health.svg)

```
[![Health](https://phpackages.com/badges/apinator-apinator-php/health.svg)](https://phpackages.com/packages/apinator-apinator-php)
```

###  Alternatives

[cboden/ratchet

PHP WebSocket library

6.4k22.0M252](/packages/cboden-ratchet)[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k686.6k13](/packages/hhxsv5-laravel-s)[phrity/websocket

WebSocket client and server

2174.6M36](/packages/phrity-websocket)[amphp/websocket-server

Websocket server for Amp's HTTP server.

124276.2k25](/packages/amphp-websocket-server)[morozovsk/yii2-websocket

simple php websocket server with examples and demo: simple chat (single daemon) - http://sharoid.ru/chat.html , pro chat (master + worker) - http://sharoid.ru/chat2.html , simple game - http://sharoid.ru/game.html

9415.2k](/packages/morozovsk-yii2-websocket)[plesk/ratchetphp

PHP WebSocket library

1881.7k2](/packages/plesk-ratchetphp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
