https://github.com/jobatator/php
The Jobatator PHP Client
https://github.com/jobatator/php
consumer jobatator php php-client
Last synced: about 1 month ago
JSON representation
The Jobatator PHP Client
- Host: GitHub
- URL: https://github.com/jobatator/php
- Owner: jobatator
- Created: 2020-04-21T07:23:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-05T09:12:12.000Z (almost 5 years ago)
- Last Synced: 2025-12-03T21:53:19.184Z (about 1 month ago)
- Topics: consumer, jobatator, php, php-client
- Language: PHP
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jobatator-php
Use this library to publish and consume jobs on a jobatator server.
## Requirements
- php >= 7.4
- ext-json
- ext-sockets
- clue/socket-raw
## Publisher usage
~~~php
$client = new \Lefuturiste\Jobatator\Client(
"localhost",
"8962",
"my_username",
"my_password",
"my_group"
);
// return true if the connexion succeeded
$client->createConnexion();
// return true if publish succeeded
$client->publish("my_job_type", ["payload" => ["something" => 12]]);
~~~
## Consumer usage
~~~php
$client = new \Lefuturiste\Jobatator\Client(
"localhost",
"8962",
"my_username",
"my_password",
"my_group"
);
$client->createConnexion();
$client->setRootValue("My root value"); // can be a container interface for example
$client->addHandler("my_job_type", function(array $payload, $rootValue) {
echo "Job handler!";
// you can use the $rootValue var to get back your $rootValue variable
});
$client->startWorker(); // will listen forever until the process stop
~~~