PHPackages                             bentools/pusher-bundle - 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. [API Development](/categories/api)
4. /
5. bentools/pusher-bundle

ActiveSymfony-bundle[API Development](/categories/api)

bentools/pusher-bundle
======================

Symfony bridge for bentools/pusher

v0.4(9y ago)150[1 issues](https://github.com/bpolaszek/bentools-pusher-bundle/issues)MITPHP

Since Feb 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bpolaszek/bentools-pusher-bundle)[ Packagist](https://packagist.org/packages/bentools/pusher-bundle)[ RSS](/packages/bentools-pusher-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

⚠️ **This bundle is now deprecated in favor of [bentools/webpush-bundle](https://github.com/bpolaszek/webpush-bundle)**

Pusher Bundle
=============

[](#pusher-bundle)

This bundle wraps the [bentools/pusher](https://github.com/bpolaszek/bentools-pusher) library to send Push Notifications through your Symfony application.

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

[](#installation)

Install the library:

```
composer require bentools/pusher-bundle

```

Add the Bundle into your `AppKernel`:

```
# app/AppKernel.php
$bundles = [
    // ...
    new BenTools\PusherBundle\BenToolsPusherBundle(),
    // ...
];
```

Define your handlers in your `services.yml`:

```
services:
    bentools.pusher.handler.mozilla:
        class: BenTools\Pusher\Model\Handler\MozillaHandler
        arguments: ['@guzzle.client.default']

    bentools.pusher.handler.gcm:
        class: BenTools\Pusher\Model\Handler\GoogleCloudMessagingHandler
        arguments: ['@guzzle.client.default', '%gcm.api_key%']
```

Update your database to store push subscriptions:

```
php bin/console doctrine:schema:update --dump-sql --force
# or use Doctrine Migrations

```

Mount the `/webpush/registration` route:

```
# app/config/routing.yml
webpush_bundle:
    resource: "@BenToolsPusherBundle/Resources/config/routing.yml"
    prefix:   /webpush
```

Install the JS assets:

```
php bin/console assets:install --symlink

```

Embed in twig (HTTPS or localhost, and authenticated user required)

```

    var registrationUrl = '{{ path('webpushbundle_register') }}';

    new subscriber({

        'onServerMessage': function(event, serverMessage) {
            console.log(event);
        },

        'onExistingSubscription' : function(subscription) {
            console.log('Existing subscription', subscription);
        },

        'onNewSubscription' : function(subscription) {
            console.log('New subscription', subscription);
            return fetch(registrationUrl, {
                method     : 'POST',
                mode       : 'cors',
                credentials: 'include',
                cache      : 'default',
                headers    : new Headers({
                    'Accept'      : 'application/json',
                    'Content-Type': 'application/json'
                }),
                body       : JSON.stringify({subscription: subscription})
            });
        }
    });

```

Usage
-----

[](#usage)

Your `BenTools\PusherBundle\Entity\Recipient` entities implement `BenTools\Pusher\Model\Recipient\RecipientInterface` and can be used in Pusher.

PHP snippet to help:

```
use AppBundle\Entity\User;
use BenTools\Pusher\Model\Message\Notification;
use BenTools\Pusher\Model\Push\Push;
use BenTools\PusherBundle\Entity\Recipient;

$pusher     = $this->getContainer()->get('bentools.pusher');
$user       = $this->getRepositoryOf(User::class)->findOneBy([
    'username' => 'johndoe',
]);
$recipients = $this->getContainer()->get('doctrine')->getManager()->getRepository(Recipient::class)->findRecipientsForUser($user);
$message    = new Notification('Ho hi');
$push       = new Push();

foreach ($recipients AS $recipient) {
    switch ($recipient->getClient()) {
        case Recipient::CHROME:
        case Recipient::CHROME_MOBILE:
            $push->addRecipient($recipient, $this->getContainer()->get('bentools.pusher.handler.gcm'));
            break;
        case Recipient::FIREFOX:
            $push->addRecipient($recipient, $this->getContainer()->get('bentools.pusher.handler.mozilla'));
            break;
    }

    $push->setMessage($message);

}

$pusher->push($push);
```

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

4

Last Release

3383d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acdd1a8ee0e657ddd06cf11f98a32100ef7121afb8aa270a5b295f5c29c038b3?d=identicon)[bpolaszek](/maintainers/bpolaszek)

---

Top Contributors

[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (8 commits)")

### Embed Badge

![Health badge](/badges/bentools-pusher-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bentools-pusher-bundle/health.svg)](https://phpackages.com/packages/bentools-pusher-bundle)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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