Pusher PHP Library
The official PHP server library for triggering events, authenticating private channels, and validating webhooks against Pusher's Channels API.
Repository Health
Technical Analysis
The Pusher PHP library is the official server-side client for Pusher’s Channels HTTP API, the realtime messaging service behind features like live chat, presence indicators, and notification feeds. It handles the signed-request authentication scheme Pusher requires, letting a PHP backend trigger events on named channels that connected clients (via Pusher’s JavaScript SDK) receive instantly over WebSockets.
Beyond triggering events, the library supports authenticating private and presence channels (verifying that a given user is allowed to subscribe), validating incoming webhooks from Pusher, and batch-triggering multiple events in a single request. It’s distributed via Composer as pusher/pusher-php-server and is maintained directly by the Pusher/Bird team as the reference server SDK for PHP applications.
What You Get
- A
Pusherclient class for triggering single or batched events on named channels - Private and presence channel authentication helpers that sign subscription requests
- Webhook validation to verify that incoming Pusher webhook payloads are authentic
- Cryptographic request signing (
PusherCrypto.php) implementing Pusher’s HMAC-based auth scheme - Typed exceptions (
ApiErrorException,PusherException) for distinguishing API errors from client-side misuse
Common Use Cases
- Triggering realtime notifications or chat messages from a PHP backend to connected browser clients
- Authenticating private or presence channel subscriptions so only authorized users can join a channel
- Validating and processing incoming Pusher webhooks (e.g. channel occupied/vacated events) server-side
- Adding live dashboards or activity feeds to a PHP application without building a custom WebSocket server
Under The Hood
Architecture: The Pusher class in src/Pusher.php is the library’s single entry point, composing request signing from PusherCrypto.php with HTTP transport to build and send authenticated requests against the Channels REST API; PusherInterface.php defines the contract so applications can mock the client in tests, and Webhook.php provides a separate, focused path for verifying inbound webhook payloads rather than overloading the main client class.
Tech Stack: It’s a lightweight PHP library with an MIT license (declared in composer.json) and minimal dependencies beyond a PSR-18-compatible HTTP client, following the standard Composer package layout without any framework binding — it can be used directly in plain PHP or wired into Laravel/Symfony broadcasting drivers.
Code Quality: The tests/ directory contains around 20 test files covering triggering, authentication, webhook validation, and error handling, run via a GitHub Actions test.yml workflow on every push; the codebase itself is small and single-purpose, which keeps its surface easy to audit even though release cadence has slowed in recent history (release_frequency ~0.24/week).
API Design: A minimal integration is a handful of lines — instantiate Pusher with your app credentials, call trigger($channel, $event, $data) — and the API vocabulary (channels, events, triggers) matches Pusher’s own product terminology directly, so developers who’ve read Pusher’s docs need almost no translation to use the PHP client.
Used by 4 apps in this directory
Bagisto
Analytics · Ecommerce
Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.
Coolify
Devops · Hosting Control Panel
Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in
Invoice Ninja
Invoicing Finance · Project Management
Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.
Pixelfed
Social Media
A decentralized, self-hosted photo sharing platform built on ActivityPub for the open Fediverse.