, (*1)
Simple API for starting non blocking jobs.
SemiThread
Right now this stuff works only under *nix systems.
It's simple wrapper API for nohup exec call., (*2)
If you want i.e. send an email in process not attached to request/response cycle it is for you., (*3)
Installation
If you don’t have Composer yet, you should get it now., (*4)
-
Add the package to your composer.json
:, (*5)
"require": {
...
"aaugustyniak/semithread": "1.0.0",
...
}
-
Install:, (*6)
$ php composer.phar install
-
And use:, (*7)
First of all You must provide your implementations of:
* Aaugustyniak\SemiThread\Cloneable
* Aaugustyniak\SemiThread\SemiThread, (*8)
examples are provided in Aaugustyniak\SemiThread\ExampleImpl.
```php
<?php, (*9)
require_once "vendor/autoload.php";
$payload = new StringPayload("This is Payload");
$envelope = new ConfinedEnvelope($payload);
$thread = new WriterThread($envelope);
/**
* Optional, redirect jobs output to file
*/
$thread->setOutput('/some/path/semi_threads.out');
$thread->start();
echo "Main process output\n";
...