PHPackages                             nextdeveloper/events - 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. nextdeveloper/events

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

nextdeveloper/events
====================

NextDeveloper Events Package

v1.2.3(3w ago)02.3k↑135.7%1MITPHPPHP &gt;=8.2.0

Since Feb 3Pushed 3w agoCompare

[ Source](https://github.com/nextdeveloper-nl/events)[ Packagist](https://packagist.org/packages/nextdeveloper/events)[ Docs](https://github.com/nextdeveloper-nl/events)[ RSS](/packages/nextdeveloper-events/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (61)Versions (36)Used By (1)

Events
======

[](#events)

This module enables the application to work between external applications and services. It provides two basic features: **listen** and **fire**. Events create eventable and listener objects in the database; when an event fires it starts a background process to trigger the related external application (IFTT-style integrations, NATS messaging, webhooks, etc.).

We needed this module to create generic third-party integrations without touching customer or end-user code directly.

The general inspiration comes from Apache Camel. (Thank you guys!)

Mechanics
---------

[](#mechanics)

This module receives an event, checks for related listeners, and triggers them via their own delivery mechanism. Supported mechanisms: Laravel Jobs (actions), NATS pub/sub, HTTP, WebSocket, gRPC.

Idea
----

[](#idea)

The idea was to let customers manage their own events using an IFTT-style logic. Events are managed in two core tables:

- `events_available` — the list of events that third parties can bind to
- `events_listeners` — the list of third-party applications listening to those events

NATS Support
------------

[](#nats-support)

This package includes first-class support for [NATS](https://nats.io) — a high-performance messaging system used to orchestrate agents and deliver real-time events to browser clients.

### What it does

[](#what-it-does)

- **Agent orchestration** — send commands to compute, storage and network agents over NATS JetStream
- **Real-time browser events** — push platform events to connected browser clients via NATS WebSocket
- **Auth callout** — validate every NATS connection against the platform database using NKey-signed JWTs (no static passwords per agent)

### Components

[](#components)

ComponentFilePurpose`NatsService``src/Services/NatsService.php`Publish and subscribe wrapper`NatsAuthCalloutService``src/Services/NatsAuthCalloutService.php`Validates credentials, signs auth-response JWTs`NkeyHelper``src/Services/NkeyHelper.php`Ed25519 NKey encoding and JWT signing`NatsAuthConfigService``src/Services/NatsAuthConfigService.php`Manages auth config`NatsListenCommand``src/Console/Commands/NatsListenCommand.php`Long-running NATS subscriber worker`NatsAuthListenerCommand``src/Console/Commands/NatsAuthListenerCommand.php`Auth callout listener — validates every NATS connection`NatsKeygenCommand``src/Console/Commands/NatsKeygenCommand.php`Generate NKey pairs for server config`NatsGenerateAuthCommand``src/Console/Commands/NatsGenerateAuthCommand.php`Generate agent auth tokens### Artisan Commands

[](#artisan-commands)

```
# Start the NATS event subscriber (queue-worker equivalent for NATS)
php artisan events:nats-listen

# Start the auth callout service (validates every incoming NATS connection)
php artisan events:nats-auth-listen

# Generate a new NKey pair for nats.conf
php artisan events:nats-keygen

# Generate an auth token for an agent
php artisan events:nats-generate-auth
```

Both `events:nats-listen` and `events:nats-auth-listen` are long-running processes and should be managed by Supervisor alongside the queue worker.

### Required .env Keys

[](#required-env-keys)

```
NATS_ENABLED=true
NATS_HOST=nats.example.com
NATS_PORT=4222
NATS_ACCOUNT_NKEY_PUBLIC=ACSGX...   # Account NKey public key (starts with A)
NATS_ACCOUNT_NKEY_SEED=SACSG...     # Account NKey seed — never expose this
NATS_AUTH_SERVICE_PASSWORD=...      # Password for the auth-service NATS user
NATS_TLS_CA=storage/nats-ca.crt    # CA cert path for TLS verification
```

### Auth Callout — How It Works

[](#auth-callout--how-it-works)

Every client that connects to NATS (agent or browser) is validated in real time by `NatsAuthCalloutService`. The service looks up the token in the database and returns a signed JWT that grants scoped publish/subscribe permissions.

```
Client connects to NATS
  └── NATS sends auth request JWT to $SYS.REQ.USER.AUTH
        └── NatsAuthListenerCommand receives it
              └── NatsAuthCalloutService checks:
                    ├── iaas_compute_members.events_token  → agent.compute permissions
                    ├── iaas_storage_members.events_token  → agent.storage permissions
                    ├── iaas_network_members.events_token  → agent.network permissions
                    └── oauth_access_tokens.id             → client.{account_uuid} permissions
              └── Returns signed authorization_response JWT
                    └── NATS allows or rejects the connection

```

Token revocation is instant — remove or nullify `events_token` in the DB and the agent is rejected on its next connection attempt.

See [docs/nats-auth-callout.md](docs/nats-auth-callout.md) for the full JWT structure specification and implementation details.

### Subject Naming Convention

[](#subject-naming-convention)

IdentitySubscribes toPublishes to`agent.compute.{uuid}``agent.compute.{uuid}.cmd`, `agent.compute.broadcast`, `agent.broadcast``agent.compute.{uuid}.evt``agent.storage.{uuid}``agent.storage.{uuid}.cmd`, `agent.storage.broadcast`, `agent.broadcast``agent.storage.{uuid}.evt``agent.network.{uuid}``agent.network.{uuid}.cmd`, `agent.network.broadcast`, `agent.broadcast``agent.network.{uuid}.evt`Browser client`client.{account_uuid}.evt`, `client.{account_uuid}.{user_uuid}.evt`nothingPlanned Feature List
--------------------

[](#planned-feature-list)

- Dynamically saving the list of events
- Triggering Action listeners
- NATS pub/sub messaging
- NATS auth callout (per-connection credential validation)
- Real-time browser events via NATS WebSocket
- Triggering external HTTP listeners
- Triggering socket listeners
- Receiving external events
- Registering external events and binding third-party events in return

---

Our Libraries
-------------

[](#our-libraries)

This library is part of the **NextDeveloper / PlusClouds open-source ecosystem**. Browse all available libraries and find the right building blocks for your next project:

---

Join the Community
------------------

[](#join-the-community)

We believe great software is built together. The PlusClouds developer community is a place where engineers share ideas, ask questions, showcase what they have built, and help shape the direction of these libraries. Whether you are integrating a single package or building an entire platform on top of our stack, you are very welcome here.

Come and join us — we would love to see what you build:

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 94.9% 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 ~33 days

Recently: every ~2 days

Total

27

Last Release

23d ago

Major Versions

v0.1.7 → v1.0.02024-12-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/95028646?v=4)[Harun Barış Bulut](/maintainers/yakari007)[@yakari007](https://github.com/yakari007)

---

Top Contributors

[![yakari007](https://avatars.githubusercontent.com/u/95028646?v=4)](https://github.com/yakari007 "yakari007 (56 commits)")[![ikhalilatteib](https://avatars.githubusercontent.com/u/69690003?v=4)](https://github.com/ikhalilatteib "ikhalilatteib (3 commits)")

---

Tags

event-driveneventsnatsnats-streaming

### Embed Badge

![Health badge](/badges/nextdeveloper-events/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346132.9M112](/packages/google-cloud-core)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)[concrete5/core

Concrete core subtree split

20166.1k52](/packages/concrete5-core)

PHPackages © 2026

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