PHPackages                             saravanasai/stream-pulse - 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. [Caching](/categories/caching)
4. /
5. saravanasai/stream-pulse

ActiveLibrary[Caching](/categories/caching)

saravanasai/stream-pulse
========================

This is my package stream-pulse

v0.1.0-beta(7mo ago)210[4 PRs](https://github.com/saravanasai/stream-pulse/pulls)MITPHPPHP ^8.2CI passing

Since Sep 19Pushed 1mo agoCompare

[ Source](https://github.com/saravanasai/stream-pulse)[ Packagist](https://packagist.org/packages/saravanasai/stream-pulse)[ Docs](https://github.com/saravanasai/stream-pulse)[ GitHub Sponsors](https://github.com/StreamPulse)[ RSS](/packages/saravanasai-stream-pulse/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (6)Used By (0)

[![StreamPulse Logo](resources/images/logo.png)](resources/images/logo.png)
===========================================================================

[](#)

Reliable Event Streaming for Laravel Applications
-------------------------------------------------

[](#reliable-event-streaming-for-laravel-applications)

StreamPulse provides a seamless event streaming experience for Laravel developers. With a clean, intuitive API that feels native to the Laravel ecosystem, you can build robust, event-driven applications with minimal setup and configuration.

[![StreamPulse Dashboard](resources/images/dashboard.png)](resources/images/dashboard.png)

> **BETA VERSION** - StreamPulse is currently in beta. We'd love your feedback to help shape its future! Star the repo, open issues, or contribute to make StreamPulse even better.

Why StreamPulse?
----------------

[](#why-streampulse)

- **Laravel-native experience** - API designed to feel natural to Laravel developers
- **Simplified event streaming** - Complex Redis Streams concepts abstracted away
- **Transaction awareness** - Events can be tied to database transactions
- **Resilient processing** - Built-in support for retries and dead letter queues
- **Real-time monitoring** - Beautiful dashboard for stream visualization and management

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require saravanasai/stream-pulse
```

> **Note:** StreamPulse is designed for distributed systems where events can be published in one Laravel application and consumed in another. Events are persisted in Redis, allowing for communication between separate applications.

### Basic Usage

[](#basic-usage)

```
// In your producer Laravel application
// Publish an event
StreamPulse::publish('orders', ['id' => 1234, 'amount' => 99.99]);

// In your consumer Laravel application
// Register an event handler - app service provider
StreamPulse::on('orders', function ($payload, $messageId) {
    OrderProcessor::process($payload);
});

// Run the consumer to process events (in the consumer app)
// php artisan streampulse:consume orders
```

Key Features
------------

[](#key-features)

- **Simple, Laravel-style API** for publishing and consuming events
- **Redis Streams integration** with plans for additional drivers
- **Consumer group support** for distributed event processing
- **Dead letter queue** for failed message handling
- **Transaction-aware publishing** to ensure data consistency
- **UI Dashboard** for monitoring streams and events

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

[](#installation-1)

You can install the package via composer:

```
composer require saravanasai/stream-pulse
```

You can publish the config file with:

```
php artisan vendor:publish --tag="stream-pulse-config"
```

You can also publish the views to customize the UI dashboard:

```
php artisan vendor:publish --tag="stream-pulse-views"
```

### Redis Requirements

[](#redis-requirements)

You need Redis 5.0+ properly configured in your Laravel application.

Usage Examples
--------------

[](#usage-examples)

### Publishing Events

[](#publishing-events)

StreamPulse provides a simple API for publishing events to any configured topic:

```
use StreamPulse\StreamPulse\Facades\StreamPulse;

// Publish an event to a topic
StreamPulse::publish('orders', [
    'id' => 1234,
    'customer' => 'John Doe',
    'total' => 99.99,
    'items' => [
        ['product_id' => 101, 'quantity' => 2, 'price' => 49.99]
    ]
]);

// Publish after DB transaction commits
StreamPulse::publishAfterCommit('orders', $orderData);
```

### Transaction-Aware Event Publishing

[](#transaction-aware-event-publishing)

Publish events only after a database transaction successfully commits:

```
use Illuminate\Support\Facades\DB;
use StreamPulse\StreamPulse\Facades\StreamPulse;

DB::transaction(function () {
    // Create an order in the database
    $order = Order::create([
        'customer_id' => 123,
        'amount' => 99.99,
    ]);

    // This event will only be published if the transaction commits successfully
    StreamPulse::publishAfterCommit('orders', [
        'id' => $order->id,
        'status' => 'created',
        'customer_id' => $order->customer_id,
        'amount' => $order->amount,
    ]);

    // If the transaction fails or is rolled back, no event will be published
});
```

### Consuming Events with Handlers

[](#consuming-events-with-handlers)

The recommended way to consume events is to register handlers for your topics:

```
// In a service provider
StreamPulse::on('orders', function ($payload, $messageId) {
    // Process the order
    OrderProcessor::process($payload);
});

// Then run the consumer command
// php artisan streampulse:consume orders
```

The consumer command will handle all the complexities of polling, acknowledgments, retries, and DLQ management for you.

### Stream Retention Management

[](#stream-retention-management)

StreamPulse automatically manages Redis streams to prevent unbounded growth:

```
// Define global defaults in config/streampulse.php
'defaults' => [
    'retention' => 1000, // Keep 1000 events per stream by default
],

// Override for specific topics
'topics' => [
    'orders' => [
        'retention' => 5000, // Keep more events for important topics
    ],
    'logs' => [
        'retention' => 500, // Keep fewer events for high-volume topics
    ],
],
```

StreamPulse uses Redis's built-in XLEN and XTRIM commands to manage stream size. The retention value specifies the maximum number of messages that should be kept in each stream. When new messages are published, older messages exceeding this limit are automatically trimmed from the stream.

Key retention considerations:

- **Higher retention values** provide longer message history but consume more memory
- **Lower retention values** minimize memory usage but reduce how far back you can access messages
- **Topic-specific overrides** allow you to balance memory usage based on each stream's importance
- **Automatic trimming** occurs during publish operations to maintain the configured limits
- **Scheduled trimming** is also performed via Laravel's scheduler to ensure streams remain within size limits even during periods of low publishing activity. In local environments, make sure to run `php artisan schedule:run` command to enable this feature.

Configuration
-------------

[](#configuration)

The published configuration file includes several sections to customize StreamPulse's behavior:

```
return [
    /*
    | Default Driver
    | Available: "redis", "nats" (NATS support coming in future releases)
    */
    'driver' => env('STREAMPULSE_DRIVER', 'redis'),

    /*
    | Strict Mode - When enabled, only explicitly defined topics can be used
    */
    'strict_mode' => env('STREAMPULSE_STRICT_MODE', true),

    /*
    | Auto Processing - Automatically process pending messages that exceed retry limits
    */
    'auto_process_pending' => env('STREAMPULSE_AUTO_PROCESS', true),

    /*
    | Global Defaults - Applied to all topics unless overridden
    */
    'defaults' => [
        'max_retries' => 3,
        'dlq' => 'dead_letter',
        'retention' => 1000,
        'min_idle_time' => 30000,  // Minimum time (ms) before re-processing pending messages
        'preserve_order' => false, // Whether to enforce strict message ordering
    ],

    /*
    | Topics - Per-topic configuration overrides
    */
    'topics' => [
        'orders' => [
            'max_retries' => 5,
            'dlq' => 'orders_dlq',
            'retention' => 5000,
            'min_idle_time' => 60000,
            'preserve_order' => true,
        ],
        // Other topics...
    ],

    /*
    | Drivers - Backend-specific configuration
    */
    'drivers' => [
        'redis' => [
            'connection' => env('REDIS_CONNECTION', 'default'),
            'stream_prefix' => 'streampulse:',
        ],
    ],

    /*
    | UI Settings - Dashboard configuration
    */
    'ui' => [
        'enabled' => env('STREAMPULSE_UI_ENABLED', true),
        'page_size' => env('STREAMPULSE_UI_PAGE_SIZE', 50),
        'route_prefix' => 'stream-pulse',
    ],
];
```

### Key Configuration Options

[](#key-configuration-options)

- **Default Driver**: Currently Redis Streams is the only implemented driver, with NATS planned for future releases.
- **Strict Mode**: Prevents accidental topic creation in production by limiting to only explicitly defined topics.
- **Auto Processing**: Automatically schedules a task to process pending messages and move them to DLQ after exceeding retry limits.
- **Global Defaults**:
    - `max_retries`: Number of retry attempts before moving to DLQ
    - `dlq`: Dead letter queue name for failed messages
    - `retention`: Maximum number of messages to retain per stream
    - `min_idle_time`: Minimum time in milliseconds before re-processing pending messages
    - `preserve_order`: Whether to enforce strict message ordering
- **Topics**: Configure specific topics with custom settings that override defaults
- **Drivers**: Backend-specific settings (currently Redis)
- **UI Settings**: Configure the included web dashboard

Advanced Usage
--------------

[](#advanced-usage)

### Low-level Consumption API

[](#low-level-consumption-api)

For more control, you can use the low-level consumption API:

```
use StreamPulse\StreamPulse\Facades\StreamPulse;

// Consume events from a topic with a consumer group
StreamPulse::consume('orders', 'order-processors', function ($payload, $messageId) {
    try {
        // Process the event
        OrderProcessor::process($payload);

        // Acknowledge the message as processed
        StreamPulse::ack('orders', $messageId, 'order-processors');
    } catch (\Exception $e) {
        // Handle error
        // The message will remain in pending state and can be retried
        // After max retries, it will be moved to the DLQ automatically
    }
});
```

UI Dashboard
------------

[](#ui-dashboard)

StreamPulse includes a web dashboard for monitoring and inspecting your streams and events:

### Dashboard Features

[](#dashboard-features)

- View all available streams/topics
- Browse events by topic with pagination - coming soon
- Examine event details including payload and metadata - coming soon
- Track failed events across all topics - coming soon
- Real-time monitoring of stream activity - coming soon
- Visual analytics of event processing - coming soon

### Accessing the Dashboard

[](#accessing-the-dashboard)

The dashboard is available at the route `/stream-pulse` and is protected by the `web` and `auth` middleware by default.

Routes include:

- Dashboard: `/stream-pulse`
- Topic Events: `/stream-pulse/topics/{topic}`

Architecture
------------

[](#architecture)

StreamPulse uses Redis Streams as the default driver, which provides:

- Persistent message storage
- Consumer groups for distributed processing
- Automatic tracking of processed messages
- Dead letter queues for failed messages
- Exactly-once delivery semantics

The architecture is designed with a driver-based approach, allowing for seamless integration of new streaming technologies as they become available.

License
-------

[](#license)

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

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance78

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.1% 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

238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f0caa9fc9828c04ce231b06b768b27bffa985f9a26cb3dfb869d57129e4ec14?d=identicon)[Saravana Thiyagarajan](/maintainers/Saravana%20Thiyagarajan)

---

Top Contributors

[![saravanasai](https://avatars.githubusercontent.com/u/36000435?v=4)](https://github.com/saravanasai "saravanasai (66 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

eventevent-drivenevent-streamingmicorservicequeueredisredis-streamsstreamstreaminglaravelStreamPulsestream-pulse

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/saravanasai-stream-pulse/health.svg)

```
[![Health](https://phpackages.com/badges/saravanasai-stream-pulse/health.svg)](https://phpackages.com/packages/saravanasai-stream-pulse)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[ryangjchandler/blade-cache-directive

Cache chunks of your Blade markup with ease.

202200.8k2](/packages/ryangjchandler-blade-cache-directive)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[innoge/laravel-policy-soft-cache

This package helps prevent performance problems with frequent Policy calls within your application lifecycle.

2356.9k](/packages/innoge-laravel-policy-soft-cache)[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)

PHPackages © 2026

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