PHPackages                             tasque/tasque - 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. tasque/tasque

ActiveProject

tasque/tasque
=============

v0.1.8(1y ago)16.5k↓50%5MITPHPPHP &gt;=8.1

Since Nov 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nytris/tasque)[ Packagist](https://packagist.org/packages/tasque/tasque)[ RSS](/packages/tasque-tasque/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (10)Used By (5)

Tasque
======

[](#tasque)

[![Build Status](https://github.com/nytris/tasque/workflows/CI/badge.svg)](https://github.com/nytris/tasque/actions?query=workflow%3ACI)

\[EXPERIMENTAL\] Run PHP background [green threads](https://en.wikipedia.org/wiki/Green_thread) concurrently.

> Note that these are not true threads: instead they are ["green threads"](https://en.wikipedia.org/wiki/Green_thread) as they still run in the single main PHP process' primary OS thread, inside a separate [Fiber](https://www.php.net/manual/en/language.fibers.php) for each, being interrupted by the Tasque scheduler when it is time to context switch either to the next background thread or back to the main thread.
>
> This is why we use the term "concurrent" rather than "parallel".

Why?
----

[](#why)

To allow periodic background tasks, such as sending keep-alive or heartbeat messages, to be performed in a traditional PHP environment where there is no event loop.

Demos
-----

[](#demos)

- See the [Tasque demo](https://github.com/nytris/tasque-demo) for an example of how Tasque is used to start multiple threads.
- See the [Tasque EventLoop demo](https://github.com/nytris/tasque-event-loop-demo) to see how [Tasque EventLoop](https://github.com/nytris/tasque-event-loop) can be used to run a ReactPHP event loop inside one of those threads, concurrently with the main thread (and any other Tasque background threads).

Usage
-----

[](#usage)

Install this package with Composer:

```
$ composer install tasque/tasque
```

Configure Nytris platform:

`nytris.config.php`

```
