2017 © Pedro Peláez
 

library simple-php-messaging-service

SimplePMS is a PHP message service with database backend using SQLite, PostgreSQL or MySQL

image

arthurhoaro/simple-php-messaging-service

SimplePMS is a PHP message service with database backend using SQLite, PostgreSQL or MySQL

  • Sunday, May 8, 2016
  • by ArthurHoaro
  • Repository
  • 1 Watchers
  • 3 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple PHP Messaging Service

Build Status Coverage Status, (*1)

SimplePMS is a very simple messaging service component with a database backend., (*2)

It allows applications to communicate without a heavy traditional client-server architecture. It is a way to manage asynchronous, potentially long-running PHP tasks such as API requests, database export/import operations, email sending, payment notification handlers, feed generation etc., (*3)

This project is based on php-queue-manager, except I wanted my messages to be only messages. Therefore, messages are not tasks in SimplePMS and are not expected to carry business code., (*4)

SimplePMS can be integrated to any PHP based application with minimum effort, because it does not depend on any framework. PDO extension is the only requirement., (*5)

If you need a more feature-full messaging service - e.g. multiple workers consuming the same queue - consider using a robust messaging service/queue manager such as JMS, ActiveMQ, RabbitMQ, IronMQ, etc. ; even though it requires a more complex setup., (*6)

Requirements

  • PHP >5.5
  • PDO
  • Database backend (sqlite, PostgreSQL, MySQL)

Features

  • Asynchronous messaging service through database.
  • Send any type of data.
  • Multiple queues.
  • A timeout system to handle stuck messages.
  • All actions are log in the DB.

Install with Composer

  • Install dependency
{
    "require": {
        "arthurhoaro/simple-php-messaging-service": "dev-master"
    }
}
  • Create your database structure using one of the schema available in extra/.

Usage example

// Your software send a message to a worker
$message = new Anything('param');
$pms = new SimplePMS();
$pms->setPdo($pdoInstance);
$pms->send($message, 'my_queue');

// The worker reads the queue
$message = $pms->reveive('my_queue');
try {
    $message->doAnything();
    $pms->deleteMessage($message);
} catch (\Exception $e) {
    $pms->log('Can not do anything. '. $e->getMessage());
}

The Versions

08/05 2016

dev-master

9999999-dev http://github.com/ArthurHoaro/simple-php-messaging-service

SimplePMS is a PHP message service with database backend using SQLite, PostgreSQL or MySQL

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-pdo *

 

The Development Requires

by Andrius Putna

queue asynchronous worker manager messaging jms batch