eichie/beanstalk

Async beanstalk driver for Amp.

Maintainers

Details

github.com/eichie/beanstalk

Source

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 27

pkg:composer/eichie/beanstalk

0.3.2 2023-07-13 11:56 UTC

This package is auto-updated.

Last update: 2025-10-13 16:49:50 UTC


README

Build Status CoverageStatus License

amphp/beanstalk is an asynchronous Beanstalk client for PHP based on Amp.

Installation

composer require amphp/beanstalk

Examples

More extensive code examples reside in the examples directory.

<?php

require __DIR__ . '/../vendor/autoload.php';

use Amp\Beanstalk\BeanstalkClient;
use Amp\Loop;

Loop::run(function () {
    $beanstalk = new BeanstalkClient("tcp://127.0.0.1:11300");
    yield $beanstalk->use('sometube');

    $payload = json_encode([
        "job" => bin2hex(random_bytes(16)),
        "type" => "compress-image",
        "path" => "/path/to/image.png"
    ]);

    $jobId = yield $beanstalk->put($payload);

    echo "Inserted job id: $jobId\n";

    $beanstalk->quit();
});

License

The MIT License (MIT). Please see LICENSE for more information.