PHPackages                             pupper/pupper-php - 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. pupper/pupper-php

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

pupper/pupper-php
=================

PHP components for Pupper

0.3.2(8y ago)1454UnlicensePHP

Since Oct 19Pushed 8y agoCompare

[ Source](https://github.com/pupper/pupper-php)[ Packagist](https://packagist.org/packages/pupper/pupper-php)[ RSS](/packages/pupper-pupper-php/feed)WikiDiscussions master Synced 4d ago

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

[![d005d89e-ff25-4450-9119-aa56ff0d8949](https://user-images.githubusercontent.com/3274103/31629229-4859fe88-b2b3-11e7-85fb-66c35710f607.png)](https://user-images.githubusercontent.com/3274103/31629229-4859fe88-b2b3-11e7-85fb-66c35710f607.png)

[![Codacy Badge](https://camo.githubusercontent.com/a813751edc19dab0246e235a0ab25516d2e41b85d907403c9d28e520f6f2b554/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3330343865656264343935333431333638373033616235386664353230326234)](https://www.codacy.com/app/bouiboui/pupper-php?utm_source=github.com&utm_medium=referral&utm_content=pupper/pupper-php&utm_campaign=badger)[![Software License](https://camo.githubusercontent.com/e6fd1430520a41e5861f1fdf2ac70cde32bdfe292a6f2ddb83681339575c7948/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d556e6c6963656e73652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e6fd1430520a41e5861f1fdf2ac70cde32bdfe292a6f2ddb83681339575c7948/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d556e6c6963656e73652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265) [![SensioLabsInsight](https://camo.githubusercontent.com/39c64240194cad5a9c636748153322012e6b5c34bdf25956e656f5f7394c2f55/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33386566386139632d646562352d343164342d613366332d3433326661343131653932312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/38ef8a9c-deb5-41d4-a3f3-432fa411e921)

Pupper stands for "PHP Plus React" (PPR &gt; Pupper). The goal is to make a Framework that takes the best of both technologies and makes them communicate bi-directionnaly.

[See an example implementation](https://github.com/bouiboui/pupper/tree/master/app)

Quick start
-----------

[](#quick-start)

Pupper PHP is based on [Aerys](https://amphp.org/aerys/), a non-blocking PHP application and Websocket framework.

Here is a quick overview of the code to get started.

```
use Pupper\Pupper\Event;

// Initiates WebSocket connection
$websocket = (new Pupper\Pupper\WebSocket)

    // Filter allowed clients (optional)
    ->allowOrigin('https', 'your.domain.com', 443);

    // Defines a callback for 'my_event'
    ->addEventListener('my_event', function (Event $event) {

        // Dispatches to all clients
        $websocket->broadcastEvent(
            new Event('notify_all', 'Something has happened!');
        );

        // Dispatches to the client that triggered the callback
        return (new Event)
            ->setName('operation_done')
            ->setValue('Your value was ' . $event->getValue());

    });

$router = Aerys\router()->route('GET', '/', Aerys\websocket($websocket));

// Exposes the websocket to the 1337 port
return (new Aerys\Host)->use($router)->expose('*', 1337);
```

API
---

[](#api)

### WebSocket

[](#websocket)

`WebSocket` is the class that initiates the WebSocket on the PHP side.

**addListener**

`addListener` takes the event name as first parameter, and a callback function as a second parameter.

If you `return` an `Event`, it will be dispatched to the client that triggered the callback.

```
use Pupper\Pupper\Event;

$websocket = (new Pupper\Pupper\WebSocket)
    ->addEventListener('custom', function (Event $event) {
        return (new Event)
            ->setName('custom')
            ->setValue('From PHP: ' . $event->getValue());
    });
```

**broadcastEvent**

`broadcastEvent` dispatches an event to all the clients.

```
use Pupper\Pupper\Event;

$websocket = (new Pupper\Pupper\WebSocket)
    ->addEventListener('player_has_joined', function (Event $event) {
        $websocket->broadcastEvent(
            'player_count_updated',
            'A new player has joined!'
        );
    });
```

**Client filtering**

Set WebSocket's constructor's protocol, host and port parameters to restrict the access to your websocket .

```
$websocket = (new \Pupper\WebSocket)->allowOrigin('https', 'your.domain.com', 80);
```

### Event

[](#event)

`Event` represents an event from the PHP side.

**Read**

`Event` has `getName()` and `getValue()` methods to read the event's name and value.

```
use Pupper\Pupper\Event;

function (Event $event) {
    echo $event->getName();
    echo $event->getValue();
});
```

**Write**

`Event` has `setName()` and `setValue()` methods to write the event's name and value.

```
use Pupper\Pupper\Event;

$event = (new Event)
    ->setName('hello_event')
    ->setValue('Hello from PHP!');
```

**Construct**

`Event`'s constructor also accepts the event's name and value as parameters.

```
use Pupper\Pupper\Event;

$event = new Event(
    'hello_event',
    'Hello from PHP!'
);
```

Credits
-------

[](#credits)

- [bouiboui](https://github.com/bouiboui)
- [All Contributors](../../contributors)

License
-------

[](#license)

Unlicense. Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~1 days

Total

7

Last Release

3126d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a58d1803bc3df932376710c1fc9082751dfc6757c3eb8dad4b82a3f39db3156?d=identicon)[bouiboui](/maintainers/bouiboui)

---

Top Contributors

[![bouiboui](https://avatars.githubusercontent.com/u/3274103?v=4)](https://github.com/bouiboui "bouiboui (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (1 commits)")

---

Tags

phppupperreactwebsockets

### Embed Badge

![Health badge](/badges/pupper-pupper-php/health.svg)

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

###  Alternatives

[codeigniter4/devkit

Development toolkit for CodeIgniter libraries and projects

68187.1k82](/packages/codeigniter4-devkit)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)

PHPackages © 2026

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