PHPackages                             sweatshop/sweatshop - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. sweatshop/sweatshop

ActiveLibrary[Queues &amp; Workers](/categories/queues)

sweatshop/sweatshop
===================

Abstraction layer for message brokers and job servers, including process management

2.3.7(10y ago)1112.3k5PHPPHP &gt;=5.3.0

Since Jan 7Pushed 10y ago5 watchersCompare

[ Source](https://github.com/oyagev/Sweatshop)[ Packagist](https://packagist.org/packages/sweatshop/sweatshop)[ Docs](https://github.com/oyagev/Sweatshop)[ RSS](/packages/sweatshop-sweatshop/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (27)Used By (0)

Sweatshop
=========

[](#sweatshop)

Sweatshop is a framework for executing asynchronous tasks in PHP with external separate workers.

Just create Worker classes, attach them to various Queues and dispatch your events and messages.
Sweatshop supports and monitors processes! Thus it's easy to create multiple workers and prevent queue locks and infinite loops.

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

[](#installation)

Fetch this library with Composer.

Concept
-------

[](#concept)

In its core, Sweatshop defines "Queues", "Workers" and "Messages". A Worker is a processing unit, an entity that's responsible to execute a defined job, based on a Message it receives.

A Queue is basically the manager. Each Queue has its own allocated workers, for specific "job topics" it supports. The Queue is responsible for delivering Messages to the appropriate Workers, monitor job execution and return the expected reply (if any) to the dispatcher.

The Queue is asynchronous, delivering messages to Workers via message brokers such as RabbitMQ, Gearman and others, thus allow non-blocking operation and background processing.

Usage
-----

[](#usage)

The most basic usage of Sweatshop, is asynchronous message processing.

Lets start with dispatching messages to Sweatshop. First instantiate the class:

```
