PHPackages                             lsv/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. lsv/pusher-bundle

ActiveBundle[API Development](/categories/api)

lsv/pusher-bundle
=================

Symfony bundle for pusher.com

v0.1.0(9y ago)01371MITPHPPHP ^5.5.9|^7.0

Since Oct 28Pushed 7y ago2 watchersCompare

[ Source](https://github.com/lsv/pusher-bundle)[ Packagist](https://packagist.org/packages/lsv/pusher-bundle)[ RSS](/packages/lsv-pusher-bundle/feed)WikiDiscussions master Synced today

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

Lsv Pusher Bundle
=================

[](#lsv-pusher-bundle)

Pusher.com bundle for symfony

Install
=======

[](#install)

```
composer require lsv/pusher-bundle

```

Add the bundle to your AppKernel

```
# app/AppKernel.php
public function registerBundles()
{
    $bundles = [
        new Lsv\PusherBundle\LsvPusherBundle(),
    ];
}
```

Add the needed configuration

```
lsv_pusher:
    app_id:
    key:
    secret:
```

There is more [configuration availible](#configuration)

Usage
=====

[](#usage)

### Controller example

[](#controller-example)

In your controller you can use

```
$this->get('lsv_pusher.pusher')->trigger('channel', 'event-name', $data);
```

This will be a `Lsv\PusherBundle\Service\PusherService` object, which extends `\Pusher` from `pusher/pusher-php-server`

Why I extend the original, is because it is not possible to add middlewares to the original, so I added them in my own

As my service extends the original, you can use all the same methods as in

### Your service

[](#your-service)

In your service you can add this to your arguments

```
services:
    your-service:
         class: YourClass
         arguments: ["@lsv_pusher.pusher"]
```

And in your YourClass

```
use Lsv\PusherBundle\Service\PusherService

class YourClass
{
    public function __construct(PusherService $pusher)
    {
    }
}
```

Configuration
=============

[](#configuration)

KeyDescriptionRequiredDefault valueTypeapp\_idYour pusher.com app\_idtruestringkeyYour pusher.com keytruestringsecretYour pusher.com secrettruestringhostPusher hostfalseapi.pusherapp.comstringtimeoutHTTP timeoutfalsenullintegerencryptedDo you want to push over HTTPSfalsefalsebooleanclusterWhich cluster are you using, will overwrite your host configurationfalsenullstringcurl\_optionsAdditional options to send with curl, [more information](#curl_options-info)falsenullarraydebugAdd debugfalsefalseboolean*Even if `debug` is false, all events will be send, and info will be send to symfony profiler*

### Full configuration example

[](#full-configuration-example)

```
lsv_pusher:
    app_id: 123
    key: 123
    secret: 123
    timeout: 20
    encrypted: true
    cluster: eu
    curl_options:
        - CURLOPT_IPRESOLVE: CURL_IPRESOLVE_V4
    debug: true
```

### curl\_options Info

[](#curl_options-info)

If you a add the constant to curl\_options like this

```
lsv_pusher:
    curl_options:
        - CURLOPT_IPRESOLVE: CURL_IPRESOLVE_V4
        - CURLOPT_SSL_VERIFYSTATUS: false
```

The constant will be translated to the corresponded integer

### Symfony 3.2+

[](#symfony-32)

In symfony 3.2+, you can do this

```
lsv_pusher:
    curl_options:
        - !php/const:CURLOPT_IPRESOLVE: !php/const:CURL_IPRESOLVE_V4
        - !php/const:CURLOPT_SSL_VERIFYSTATUS: false
```

Events
======

[](#events)

EventWhenClassMethods`lsv_pusher.event.trigger`Before trigger is sendTriggerEvent`getChannels()` An array of channel names to publish the event on.

`getEvent()` Event name

`getData()` Event data

`getSocketId()`

`isDebug()`

`isAlreadyEncoded()``lsv_pusher.event.trigger.response`After trigger is send, including the responseTriggerResponseEventSame as `lsv_pusher.event.trigger` but with `getResponse()``lsv_pusher.event.triggerbatch`Before triggerBatch is sendTriggerBatchEvent`getBatch()` - Array of triggers

`isDebug()`

`isAlreadyEncoded()``lsv_pusher.event.triggerbatch.response`After triggerBatch is send, including the responseTriggerBatchResponseEventSame as `lsv_pusher.event.triggerbatch` but with `getResponse()``lsv_pusher.event.channelinfo`Before get\_channel\_info is sendChannelInfoEvent`getChannel()` The name of the channel

`getParams()` Additional parameters for the query`lsv_pusher.event.channelinfo.response`After get\_channel\_info is send, including the responseChannelInfoResponseEventSame as `lsv_pusher.event.channelinfo` but with `getResponse()``lsv_pusher.event.channels`Before get\_channels is sendChannelsEvent`getParams()` Additional parameters for the query`lsv_pusher.event.channels.response`After get\_channels is send, including the responseChannelsResponseEventSame as `lsv_pusher.event.channels` but with `getResponse()``lsv_pusher.event.get`Before get is sendGetEvent`getPath()` Path excluding /apps/APP\_ID

`getParams()` API params`lsv_pusher.event.get.response`After get is send, including the responseGetResponseEventSame as `lsv_pusher.event.get` but with `getResponse()`All event classes are in the namespace of `Lsv\PusherBundle\Event`

In all event classes you can use the NAME constant to get the dispatched event name, fx `Lsv\PusherBundle\Event\TriggerBatchEvent::NAME`

Symfony profiler
================

[](#symfony-profiler)

All response requests will be shown in the profiler, just like this

[![Symfony profiler example](Resources/images/profiler.png)](Resources/images/profiler.png)

Command
=======

[](#command)

One command is provided to test a pusher.cosend the test to trigger

lsv:pusher:test

Optional options can also be added

OptionDescriptionTypeDefault value--channelsChannels to send a test push tostring, arrayarray(test1, test2)--eventEvent name to send the test push tostringtest--dataEvent data to send the test push tostring, arraytestLicense
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2016 Martin Aarhof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3532d ago

### Community

Maintainers

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

---

Top Contributors

[![lsv](https://avatars.githubusercontent.com/u/20708?v=4)](https://github.com/lsv "lsv (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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