PHPackages                             pushman/phplib - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pushman/phplib

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pushman/phplib
==============

The Pushman.dfl.mn PHP Library

2.4(10y ago)174302[1 issues](https://github.com/PushmanPHP/pushman_php_library/issues)MITPHP

Since May 13Pushed 10y ago3 watchersCompare

[ Source](https://github.com/PushmanPHP/pushman_php_library)[ Packagist](https://packagist.org/packages/pushman/phplib)[ RSS](/packages/pushman-phplib/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

pushman\_php
============

[](#pushman_php)

The Pushman PHP Library

[![Latest Stable Version](https://camo.githubusercontent.com/a8c070bc7337906fb42e09d208a630efe95f630c5d948fbe5b8c46dca4fa164b/68747470733a2f2f706f7365722e707567782e6f72672f707573686d616e2f7068706c69622f762f737461626c65)](https://packagist.org/packages/pushman/phplib) [![Total Downloads](https://camo.githubusercontent.com/c1616a124c0cfc182efbced31eb919a8c9f51038870c7d30aae71256645ed003/68747470733a2f2f706f7365722e707567782e6f72672f707573686d616e2f7068706c69622f646f776e6c6f616473)](https://packagist.org/packages/pushman/phplib) [![Latest Unstable Version](https://camo.githubusercontent.com/8a763e16beb6d0e84587a914c66e2ad1c03eb5ba4988fb1e6f1ae79a2e74b273/68747470733a2f2f706f7365722e707567782e6f72672f707573686d616e2f7068706c69622f762f756e737461626c65)](https://packagist.org/packages/pushman/phplib) [![License](https://camo.githubusercontent.com/9d67867923da71b33ebf187c7d71d4deef63fbee82f55b3d49907b4a90807432/68747470733a2f2f706f7365722e707567782e6f72672f707573686d616e2f7068706c69622f6c6963656e7365)](https://packagist.org/packages/pushman/phplib)

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

[](#installation)

```
composer require pushman/phplib
```

Usage
-----

[](#usage)

```
use Pushman\PHPLib\Pushman;
$pushman = new Pushman('private-key-goes-here');

$response = $pushman->push('kittens_are_cute', 'public', ['foo' => 'asdasdasdasd']);
```

As of version 2.1.0 in Pushman, you can push to multiple channels by feeding an array into the channels variable.

```
use Pushman\PHPLib\Pushman;
$pushman = new Pushman('private-key-goes-here');

$response = $pushman->push('kittens_are_cute', ['public', 'auth'], ['foo' => 'asdasdasdasd']);
```

On your own pushman instance:

```
use Pushman\PHPLib\Pushman;
$pushman = new Pushman('private-key-goes-here, ['url' => 'http://pushman.yoursite.com']);

$response = $pushman->push('kittens_are_cute', 'public', ['foo' => 'asdasdasdasd']);
```

`$response` will always return a JSON payload with `status` and `message` along with any other relevant information about your event.

#### Extending Laravel

[](#extending-laravel)

You can also extend Laravels `event()` functionality by including the Pushman ServiceProvider in your `config/app.php` file. Add the service provider `Pushman\PHPLib\PushmanServiceProvider` in your app.php file and then in your `.env` file, add the following keys:

```
PUSHMAN_PRIVATE=60_char_private_token_here
PUSHMAN_URL=http://pushman.yoursite.com

```

Later in your `config/broadcasting.php` file, add in under `connections` the Pushman settings:

```
'pushman' => [
    'driver'  => 'pushman',
    'private' => env('PUSHMAN_PRIVATE'),
    'url'     => env('PUSHMAN_URL'),
],
```

From that point onwards, you can use `php artisan make:event {Name}` to make a Laravel Event, inside that event implement `ShouldBroadcast`, and in your `broadcastOn` function, return an array of channels you want to broadcast on.

##### Example

[](#example)

`php artisan make:event UserCreated` - Called when a user is created.

```
$user = new User([
	'name' => 'James Duffleman',
	'email' => 'george@duffleman.co.uk',
	'password' => bcrypt('aPassword')
]);

event(new UserCreated($user));
```

```
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class UserCreated extends Event implements ShouldBroadcast {

    public $user;

    public function __construct($user)
    {
        $this->user = $user;
    }

    public function broadcastOn()
    {
        return ['public'];
    }
}
```

### Getting Information

[](#getting-information)

Because Pushman can generate your public token every 60 minutes, updating your clients should be an automatic process. You can use the following code to grab the public token of any channel.

```
use Pushman\PHPLib\Pushman;
$pushman = new Pushman('private-key-goes-here');

$response = $pushman->token('public');
$token = $response['token'];
```

And you can load all channel information by the `channels()` and `channel()` method.

```
use Pushman\PHPLib\Pushman;
$pushman = new Pushman('private-key-goes-here');

$response = $pushman->channel('auth');
$max_connections = $response['max_connections'];

$response = $pushman->channels();
foreach($response as $channel) {
	echo("Found channel {$channel['name']}.\n");
}
```

Todo for Future Versions
------------------------

[](#todo-for-future-versions)

- Add endpoint support for /api/subcribers.
- Add some sort of trait/interface so you can append it to your existing user model and broadcast out easily to that specific user.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

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 ~4 days

Total

7

Last Release

3998d ago

Major Versions

1.0.0 → 2.0.02015-05-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/45f4521df25fa81f638ba15f7df5e894056fa902cf9d9664d6b0d82801374a2a?d=identicon)[DuffleOne](/maintainers/DuffleOne)

### Embed Badge

![Health badge](/badges/pushman-phplib/health.svg)

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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