https://github.com/xobotyi/beansclient
Robust PHP client for beanstalkd work queue
https://github.com/xobotyi/beansclient
beanstalk beanstalkd client php queue
Last synced: 25 days ago
JSON representation
Robust PHP client for beanstalkd work queue
- Host: GitHub
- URL: https://github.com/xobotyi/beansclient
- Owner: xobotyi
- License: mit
- Created: 2018-03-07T08:04:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-10T00:58:49.000Z (over 2 years ago)
- Last Synced: 2025-05-20T09:04:27.065Z (about 2 months ago)
- Topics: beanstalk, beanstalkd, client, php, queue
- Language: PHP
- Homepage:
- Size: 316 KB
- Stars: 92
- Watchers: 7
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# beansclient
[](https://packagist.org/packages/xobotyi/beansclient)
[](https://packagist.org/packages/xobotyi/beansclient)
[](https://packagist.org/packages/xobotyi/beansclient)
[](https://github.com/xobotyi/beansclient/actions)
[](https://app.codecov.io/gh/xobotyi/beansclient)
[](https://packagist.org/packages/xobotyi/beansclient)
[](https://packagist.org/packages/xobotyi/beansclient)## About
BeansClient is a PHP8 client for [beanstalkd work queue](https://github.com/kr/beanstalkd) with thorough unit-testing.
Library uses PSR-4 autoloader standard and always has 100% tests coverage.
Library gives you a simple way to provide your own Socket implementation, in cases when you need to log requests and
responses or to proxy traffic to non-standard transport.BeansClient supports whole bunch of commands and responses specified
in [protocol](https://github.com/kr/beanstalkd/blob/master/doc/protocol.txt) for version 1.12## Why BeansClient?
1. Well tested.
2. Supports UNIX sockets.
3. Actively maintained.
4. Predictable (does not throw exception in any situation, hello `pheanstalk`🤪).
5. PHP8 support.## Contents
1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Docs](#docs)
* TBD## Requirements
- [PHP](//php.net/) 8.0+
- [beanstalkd](//github.com/kr/beanstalkd/) 1.12+## Installation
Install with composer
```bash
composer require xobotyi/beansclient
```## Usage
```php
put("job's payload", delay: 2);
if($job['state'] === Beanstalkd::JOB_STATE_DELAYED) {
echo "Job {$job['id']} is ready to be reserved within 2 seconds\n";
}## ##
# WORKER #
## ##$client->watchTube('myAwesomeTube2');
$job = $client->reserve();
if ($job) {
echo "Hey, i received first {$job['payload']} of job with id {$job['id']}\n";$client->delete($job['id']);
echo "And i've done it!\n";
}
else {
echo "So sad, i have nothing to do";
}echo "Am I still connected? \n" . ($client->socket()->isConnected() ? 'Yes' : 'No') . "\n";
```