Search by

blipyx / blipyx-php

sanyva

PHP client for Blipyx — publish realtime events over HTTP and authorize private channels. Works on any hosting.

v1.0.0 2026-10-04 13:48 UTC

This package is not auto-updated.

Last update: 2026-11-02 10:52:36 UTC


README

PHP client for Blipyx — realtime events for your PHP app without running a WebSocket server.

  • Publish events from your backend with one HTTP call
  • Authorize private channels for your users
  • Only ext-curl — works on any shared hosting, PHP 7.4+

Installation

composer require blipyx/blipyx-php

Get your App Key and App Secret in the dashboard. The secret stays on your server — never put it into browser code.

Publish an event

use Blipyx\Blipyx;

$blipyx = new Blipyx('YOUR_APP_KEY', 'YOUR_APP_SECRET');

$blipyx->trigger('orders', 'order.created', ['id' => 42, 'total' => 99.5]);
// ['ok' => true, 'delivered' => 3]

Every browser subscribed to orders receives the event:

const bx = new Blipyx('YOUR_APP_KEY')
bx.subscribe('orders').on('order.created', (order) => console.log(order))

Pass a socket_id as the 4th argument to skip the connection that caused the event.

Private channels

Channels named private-* require a signature from your backend. The browser client calls your auth endpoint with socket_id and channel_name; you check access and sign:

// Laravel: config/services.php → 'blipyx' => ['key' => env('BLIPYX_KEY'), 'secret' => env('BLIPYX_SECRET')],
// routes/web.php
Route::post('/blipyx/auth', function (Illuminate\Http\Request $request) {
    $blipyx = new Blipyx\Blipyx(config('services.blipyx.key'), config('services.blipyx.secret'));
    $channel = $request->input('channel_name');

    // Your access check, e.g. private-user-{id}
    abort_unless($channel === 'private-user-' . $request->user()->id, 403);

    return $blipyx->authorizeChannel($request->input('socket_id'), $channel);
})->middleware('auth');
// Plain PHP: auth.php
require 'vendor/autoload.php';
session_start();
$blipyx = new Blipyx\Blipyx('YOUR_APP_KEY', 'YOUR_APP_SECRET');
$input = json_decode(file_get_contents('php://input'), true);

if ($input['channel_name'] !== 'private-user-' . $_SESSION['user_id']) {
    http_response_code(403);
    exit;
}

header('Content-Type: application/json');
echo json_encode($blipyx->authorizeChannel($input['socket_id'], $input['channel_name']));

Browsers can also send events to each other (channel.trigger(...)) — only on private channels.

Errors

trigger() throws Blipyx\BlipyxException; getCode() is the HTTP status:

CodeMeaning
400Invalid channel, event or data (data: string or array, up to 100 KB)
401Wrong App Key or App Secret
429Rate limit of your plan exceeded
0Network error

Options

new Blipyx($key, $secret, [
    'host' => 'https://wss.blipyx.com',      // API server
    'timeout' => 5,                          // seconds
]);

License

MIT