Download the PHP package stolfam/generic-producer-consumer-queue-php without Composer
On this page you can find all versions of the php package stolfam/generic-producer-consumer-queue-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stolfam/generic-producer-consumer-queue-php
More information about stolfam/generic-producer-consumer-queue-php
Files in stolfam/generic-producer-consumer-queue-php
Package generic-producer-consumer-queue-php
Short Description Simple PHP8 classes for queueing data streams.
License MIT
Informations about the package generic-producer-consumer-queue-php
generic-producer-consumer-queue-php
If you struggling with queueing your data streams like bulk imports or exports, you can use my simple solution. These are simple classes for queueing data streams.
Requirements
- PHP 8
Preparing
Prepare your messages extending abstract class Message
. It prevents parsing errors with built-in function isValid()
located in abstract constructor.
Implements interface Consumer
and create your own consumer logic.
Using
See folder /tests
for examples, or start with class Manager
like this:
Add one or more consumers, which process your messages (data):
In your consumer script, you start calling function run()
and messages will be processed:
In your producer script, you can start adding messages:
Notes
- You can run function
run()
ofclass Manager
in your script as a daemon - One
class Manager
can process different types of messages. It depends on how many consumers you add.Storages
You can implement your own storages for messages or you can use a default one
class FileStorage
.