PHPackages                             entanet/pub-sub-event - 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. entanet/pub-sub-event

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

entanet/pub-sub-event
=====================

Wrapper for laravel events so that an event can be published without using a listener.

239[1 PRs](https://github.com/Entanet/pubsubevent/pulls)PHP

Since Sep 27Pushed 7y ago8 watchersCompare

[ Source](https://github.com/Entanet/pubsubevent)[ Packagist](https://packagist.org/packages/entanet/pub-sub-event)[ RSS](/packages/entanet-pub-sub-event/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Pub Sub Event
=============

[](#pub-sub-event)

Wrapper for Laravel events so that an event can be published externally without using a listener.

Prerequisities
--------------

[](#prerequisities)

- [Laravel](https://laravel.com/) 5.6+
- [superbalist/laravel-pubsub](https://github.com/Superbalist/laravel-pubsub) 3.0+

### Installing

[](#installing)

Run the below in your Laravel project to install the library:

```
    composer require entanet/pub-sub-event

```

### Registering the service provider

[](#registering-the-service-provider)

To register the PubSubEventProvider add the below line into the providers array in config/app.php in Laravel:

```
    'providers' => [
    ...
    \Entanet\PubSubEvent\PubSubEventServiceProvider::class
    ...

```

### Add an alias to the Pub Sub Event Facade

[](#add-an-alias-to-the-pub-sub-event-facade)

To add an alias to the facade add the following to the alias array in config/app.php in Laravel:

```
    'aliases' => [
    ...
    'PubSubEvent' => \Entanet\PubSubEvent\PubSubEventFacade::class,
    ...

```

Also you can alter the current event alias so that any current Event calls use the Pub Sub Event:

Change:

```
    'aliases' => [
    ...
    'Event' =>  Illuminate\Support\Facades\Event::class,
    ...

```

To:

```
    'aliases' => [
    ...
    'Event' => \Entanet\PubSubEvent\PubSubEventFacade::class,
    ...

```

### Overriding the Laravel global helper event

[](#overriding-the-laravel-global-helper-event)

Laravel comes with a global helper [event](https://laravel.com/docs/5.6/helpers#method-event) which dispatches the given event so you don't have to use the facade. If you want to override that helper with the Pub Sub Event you need to require the PubSubEventHelper.php file before the vendor/autoload.php. Here is an example, altering the public/index.php file in Laravel 5.6:

```
      // PubSubEventHelper.php is used to override the laravel global event helper.
       require __DIR__.'/../vendor/entanet/pub-sub-event/src/PubSubEventHelper.php';
       require __DIR__.'/../vendor/autoload.php';

```

### Using Pub Sub Event via the Alias/facade

[](#using-pub-sub-event-via-the-aliasfacade)

Call dispatch from the facade and supply a relevant event contianing the event data and topic (new \\App\\Events\\PubEvent($data, 'topic\_name'))

```
    PubSubEvent::dispatch(new \App\Events\PubEvent($data), 'topic_name');

```

Or if you have altered the existing Event alias:

```
    Event::dispatch(new \App\Events\PubEvent($data), 'topic_name');

```

### Using Pub Sub Event via event global helper

[](#using-pub-sub-event-via-event-global-helper)

If you overridden the global helper:

```
    event(new \App\Events\PubEvent($data), 'topic_name');

```

### What does pub sub do with the topic?

[](#what-does-pub-sub-do-with-the-topic)

Pub Sub Event will check for a topic and if it exists publish the json\_encoded event object.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6546fb2ad80a5dca7970363700647c34b8ae058527ff2569439089f27b2a868b?d=identicon)[mark-jones-entanet](/maintainers/mark-jones-entanet)

![](https://www.gravatar.com/avatar/a63f790da330037f4fbfa56da6b325675cec3f20c79f9446462fafbf143fbfc3?d=identicon)[tom-lloyd-entanet](/maintainers/tom-lloyd-entanet)

![](https://www.gravatar.com/avatar/31e88d8c91c1da6762a85191570b356c253a7be91559d8c16042abb042b13b7f?d=identicon)[dickinsonjl](/maintainers/dickinsonjl)

### Embed Badge

![Health badge](/badges/entanet-pub-sub-event/health.svg)

```
[![Health](https://phpackages.com/badges/entanet-pub-sub-event/health.svg)](https://phpackages.com/packages/entanet-pub-sub-event)
```

###  Alternatives

[helicon/object-mapper

Simple object mapping.

191.2k](/packages/helicon-object-mapper)

PHPackages © 2026

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