An event stream library based on tail

Overview

TailEventStream

An event stream library based on tail.

Note: I don't think you should use this library in a real project, but it's great for educational purposes. I use it in workshops only."

Getting started

Install using Composer:

composer require matthiasnoback/tail-event-stream 

Usage

Adding messages to the stream:

use TailEventStream\Producer;

$streamFilePath = __DIR__ . '/var/stream.txt';

$producer = new Producer($streamFilePath);
$producer->produce('hello_world', ['Hello' => 'World!']);

The stream.txt file contains one message per line:

{"messageType":"hello_world","data":{"Hello":"World!"}}

Using tail -f a consumer can read each message from the stream, and it will keep consuming messages until you quit the process:

use TailEventStream\Consumer;

$streamFilePath = __DIR__ . '/var/stream.txt';

$consumer = new Consumer($streamFilePath);

$consumer->consume(function (string $messageType, array $data) {
    // $messageType will be 'hello_world'
    // $data will  be ['Hello' => 'World!']
});

consume() accepts a second argument, which is the index (or line) at which to start.

You might also like...
Awes.io // boilerplate based on Vue, Nuxt, TailwindCSS plus Laravel as a backend. 🤟
Awes.io // boilerplate based on Vue, Nuxt, TailwindCSS plus Laravel as a backend. 🤟

Platform for Interactive Business Applications 10x faster to create than the traditional way • 3x increase application experiences • 60% decrease in d

Determine the geographical location of website visitors based on their IP addresses.

GeoIP for Laravel Determine the geographical location and currency of website visitors based on their IP addresses. GeoIP for Laravel on Packagist Geo

Ubilling is opensource ISP billing system based on stargazer

Ubilling Ubilling is opensource ISP billing system based on stargazer. Please visit our official resources: Project homepage Documentation Community f

PHP package to help the development of Laravel-based Telegram bots
PHP package to help the development of Laravel-based Telegram bots

Laravel-telegram-bot Project description goes here. This description is usually two to three lines long. It should give an overview of what the projec

Laravel blade directives and php helpers for serverside rendered content, based on browser window size WITHOUT css

Laravel Window Size and Breakpoints Laravel blade directives and php helpers for server side rendered content, based on browser window size WITHOUT cs

MediaDB is a web-based media streaming service written in Laravel and Vue.

MediaDB (API) MediaDB is a web-based media streaming service written in Laravel and Vue. The nginx-vod-module is used for on-the-fly repackaging of MP

Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily.
Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily.

DevMakerLab/Laravel-Filters Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily. Insta

A simple laravel package to handle multiple key based model route binding

Laravel Model UUID A simple package to handle the multiple key/column based route model binding for laravel package Installation Require the package u

Gretel is a Laravel package for adding route-based breadcrumbs to your application.
Gretel is a Laravel package for adding route-based breadcrumbs to your application.

Gretel Laravel breadcrumbs right out of a fairy tale. Gretel is a Laravel package for adding route-based breadcrumbs to your application. Defining Bre

Releases(v0.1.1)
Owner
Matthias Noback
Matthias Noback
A simple package to forward Laravel application logs to a Kinesis stream

Laravel Monolog Kinesis Driver A simple package to forward Laravel application logs to a Kinesis stream. Installation Require the package with compose

Pod Point 34 Sep 6, 2022
A simple and modern approach to stream filtering in PHP

clue/stream-filter A simple and modern approach to stream filtering in PHP Table of contents Why? Support us Usage append() prepend() fun() remove() I

Christian Lück 1.5k Dec 29, 2022
A simple Laravel event log package for easy model based logging.

Karacraft Logman A simple Model Event Logging Package Usage Installation composer require karacraft/logman Migrate php artisan migrate Publish php a

Karacraft 0 Dec 28, 2021
Transaction-aware Event Dispatcher for Laravel

Transaction-aware Event Dispatcher for Laravel This Laravel package introduces Transaction-aware Event Dispatcher. It ensures the events dispatched wi

Francisco Neves 299 Nov 29, 2022
PlayZ is an esport event organization and management website allowing the creation of tournaments on the most popular video games of the esport scene.

PlayZ the playz to play Table of Contents Description "What is Playz?" In one sentence PlayZ is "an esport event organization and management website a

Antoine Saunier 2 Dec 7, 2021
A lightweight domain event pattern implementation for Doctrine2.

Knp Rad Domain Event A lightweight domain event pattern implementation for Doctrine2. Official maintainers: @Einenlum Installation With composer : $ c

KNP Labs 5 Sep 23, 2022
Attendize is an open-source ticketing and event management application built using the Laravel PHP framework

Attendize is an open-source ticketing and event management application built using the Laravel PHP framework. Attendize allows event organisers to sel

Attendize 3.6k Dec 27, 2022
A minimalistic event calendar Tool for Laravel's Nova 4

Event calendar for Laravel Nova 4 An event calendar that displays Nova resources or other time-related data in your Nova 4 project on a monthly calend

wdelfuego 44 Jan 1, 2023
Laravel Event Visualizer

Laravel package to visualize events with their handlers, including jobs to chain them together.

Jonas Pardon 4 Dec 30, 2022
Library that offers Input Filtering based on Annotations for use with Objects. Check out 2.dev for 2.0 pre-release.

DMS Filter Component This library provides a service that can be used to filter object values based on annotations Install Use composer to add DMS\Fil

Rafael Dohms 89 Nov 28, 2022