Library / SDK
pusher/pusher-http-php avatar
pusher/pusher-http-php

pusher-http-php for publishing Pusher Channels events

PHP library for interacting with the Pusher Channels HTTP API

1,477 stars316 forksPHPLicense varies

At a glance

What is it?
The pusher-http-php library gives PHP applications a direct interface to the Pusher Channels HTTP API. It supports synchronous and Guzzle promise-based publishing, batches, encrypted channels, custom HTTP clients, and PSR-3 logging.
Who is it for?
PHP applications that need direct control over Pusher Channels publishing should evaluate this library, while Laravel applications may prefer the framework's built-in broadcasting backend. Before adoption, verify that the application runs a supported PHP version, confirm the constructor credentials and cluster configuration, and review the undocumented license information together with the API limits and experimental channel-info feature.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 77 days ago.
What is it written in?
Mainly PHP, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Direct Pusher Channels publishing from PHP

pusher-http-php addresses a specific server-side task: publishing events to Pusher Channels through its HTTP API. It is intended for PHP applications that have Pusher application credentials and need to send event data to one channel, several channels, or a batch of channel events. The Composer package is named `pusher/pusher-php-server`, while its repository is `pusher/pusher-http-php`, which is an important distinction when locating the package.

The library is not a general-purpose message queue or client-side WebSocket package. Its documented center of gravity is server-side interaction with Pusher Channels. Event publication is exposed through `trigger` and `triggerBatch`, with asynchronous counterparts named `triggerAsync` and `triggerBatchAsync`. This makes it relevant to PHP applications that publish server-generated events, such as notifications or state changes, but the README does not document features such as replay, queue buffering, delivery guarantees, or offline event storage.

Credential requirements also define the audience. A server needs a Pusher application ID, key, and secret, plus the cluster associated with the application. Those credentials are passed to `Pusher\Pusher`, so the library is more relevant to trusted server environments than browser code. The repository does not describe browser-side authentication or a separate public-client mode.

How trigger requests become Pusher API calls

The documented mechanism is a PHP client object that uses Guzzle internally for HTTP calls. A `Pusher\Pusher` instance is created with the application key, secret, ID, and an options array. The library then exposes methods that turn channel names, event names, and payloads into requests to the Pusher Channels HTTP API. The precise internal request-building classes are not described in the README, so their names and serialization sequence should not be inferred from the repository layout.

The `trigger` method accepts either one channel or an array of channels. Its event name and data are sent to those destinations in one call. Arrays used as event data are automatically converted to JSON according to the README. This removes the need for callers to perform that initial encoding step, although it does not mean every possible PHP value can safely be represented as JSON.

An optional `socket_id` can be supplied when triggering an event. The README connects this option with excluding event recipients, which lets server code avoid sending an update back to the connection that produced it. Experimental publish information can also be requested through the `info` parameter. The `subscription_count` example reads channel attributes from the returned result, so this operation is not simply fire-and-forget. Because the README labels channel information fetched during publishing as experimental, production adoption should account for the possibility that the response contract changes.

Composer installation and first Pusher event

The project documents installation through Composer. Install the package into an existing PHP project with the command below. Composer resolves `pusher/pusher-php-server` and records it in the project's dependency configuration.

bash
$ composer require pusher/pusher-php-server

After creating credentials in a Pusher application, initialize the client. The constructor places the key and secret before the application ID, so argument order is worth checking during integration. The fourth argument carries options such as `cluster`.

php
$app_id = 'YOUR_APP_ID';
$app_key = 'YOUR_APP_KEY';
$app_secret = 'YOUR_APP_SECRET';
$app_cluster = 'YOUR_APP_CLUSTER';

$pusher = new Pusher\Pusher($app_key, $app_secret, $app_id, ['cluster' => $app_cluster]);

With that object available, publish a string event to one channel as shown below. According to the README, a successful call returns the API result, although it does not provide a complete response example for this basic request.

php
$pusher->trigger('my-channel', 'my_event', 'hello world');

The README also documents adding the package manually to `composer.json`. This is useful when dependency changes are maintained through a reviewed configuration file.

json
"require": {
    "pusher/pusher-php-server": "^7.3"
}

After changing that file, the documented dependency command is `composer update`. The README supports PHP 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, and 8.4.

Batches, Guzzle promises, and HTTP configuration

Publishing several events does not require several independent PHP statements. `triggerBatch` accepts an array in which each item identifies a `channel`, `name`, and `data`. The README states that a call can contain at most 10 events on multi-tenant clusters. That limit is specific and should shape batch design. A caller that assembles more than 10 entries must avoid assuming that the library will split or successfully submit the entire batch.

php
$batch = [];
$batch[] = ['channel' => 'my-channel', 'name' => 'my_event', 'data' => ['hello' => 'world']];
$batch[] = ['channel' => 'my-channel', 'name' => 'my_event', 'data' => ['myname' => 'bob']];
$pusher->triggerBatch($batch);

For asynchronous publication, `triggerAsync` returns a Guzzle promise. The caller can attach behavior with `then`, although the workflow shown in the README also waits for `$promise->wait()`, which means that example still blocks until the result is available. Treating that as nonblocking requires code that does not call `wait()` and properly handles the promise lifecycle.

php
$promise = $pusher->triggerAsync(['channel-1', 'channel-2'], 'my_event', 'hello world');

$promise->then(function($result) {
  // do something with $result
  return $result;
});

$final_result = $promise->wait();

The options array also controls `scheme`, `host`, `port`, `path`, `timeout`, `useTLS`, and `cluster`. Calls use HTTPS by default. Setting `useTLS` to false disables that transport setting, but doing so exposes credentials and API traffic to a different transport model. The README also allows a custom Guzzle instance as the fifth constructor argument, which is the documented route for middleware or other HTTP client customization.

Encrypted channels, logging, and maintenance boundaries

The constructor supports an `encryption_master_key_base64` option for encrypted channels. The README describes it as a 32-character key used with the channel name to derive a per-channel encryption key. Event data on an encrypted channel is encrypted with that derived key. This is a protocol feature, but the library does not document key storage, rotation, recovery, or how clients obtain the encryption material. Those operational details cannot be inferred from the option alone.

Logging follows PHP standards rather than requiring a particular logging package. The `Pusher` object implements `Psr\Log\LoggerAwareInterface`, and the recommended logger also implements `Psr\Log\LoggerInterface`.

php
$pusher->setLogger($logger);

The repository is not archived. Its last push was on 2026-08-07, and release 7.3.0 carries the same date. That is recent repository activity, but it does not by itself document the breadth of supported API changes or a compatibility window for older Pusher server API features.

The repository information does not contain a license identifier. The README includes a Packagist license badge, but its target does not establish the actual terms in the repository content shown here. No legal interpretation can be made from that missing identifier. Upgrade planning should also distinguish a package update from a hosted API change, because the README covers library installation and release compatibility but does not publish a separate server API deprecation policy.

Laravel broadcasting versus direct HTTP API access

Laravel provides a real alternative path for applications already using that framework. The README states that Laravel 8.29 and above has built-in support for Pusher Channels as a broadcasting backend. That approach connects application events to Laravel's broadcasting facilities instead of requiring each integration to construct `Pusher\Pusher` and define HTTP publication details directly. The README does not document the configuration or event mapping needed to use Laravel's backend, so this article cannot supply those steps.

The practical difference is abstraction. Direct use of pusher-http-php exposes methods and options for channels, batches, asynchronous Guzzle promises, socket IDs, custom HTTP middleware, encryption, and experimental publish metadata. Laravel's built-in support sits inside the framework's own broadcasting model, which may be a better fit when the application already organizes outgoing events around Laravel events and broadcast channels.

For other supported PHP frameworks, the README says the library can be used directly. It does not claim a native integration for any named framework beyond Laravel. That distinction matters: an application may technically be compatible with supported PHP while still needing to handle credential configuration, error handling, and result handling itself.

The library is a poor fit for code that only needs a native Laravel broadcasting abstraction, or for an application that cannot make outbound HTTP requests to Pusher. It also offers no documented local queue or retry policy. Those are constraints of the documented scope, not claims that its underlying API can never be combined with a queue or retry layer.

Editorial conclusion

PHP applications that need direct control over Pusher Channels publishing should evaluate this library, while Laravel applications may prefer the framework's built-in broadcasting backend. Before adoption, verify that the application runs a supported PHP version, confirm the constructor credentials and cluster configuration, and review the undocumented license information together with the API limits and experimental channel-info feature. The clearest adoption boundary is direct HTTP API access through `Pusher\Pusher` versus Laravel's higher-level broadcasting abstraction.

Frequently asked questions

How do I install pusher-http-php with Composer?

Install the `pusher/pusher-php-server` package by running `composer require pusher/pusher-php-server`. The README also documents adding `pusher/pusher-php-server: ^7.3` to `composer.json` and then running `composer update`.

How do I publish an event with pusher-http-php?

Create a `Pusher\Pusher` instance with the application credentials, then call `trigger` with a channel, event name, and data. Pass an array as the first argument to publish the event to multiple channels.

Does pusher-http-php support asynchronous publishing and custom HTTP clients?

Yes. `triggerAsync` and `triggerBatchAsync` return Guzzle promises, and the constructor accepts a custom Guzzle client as its fifth argument. The README says this permits application-provided middleware.

Official sources

  1. Issues
  2. Project website
  3. pusher/pusher-http-php on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pusher-pusher-http-php.svg)](https://hysenlabs.com/projects/pusher-pusher-http-php)

Was this useful?