PHPackages                             sunkan/percurri - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. sunkan/percurri

ActiveLibrary[Queues &amp; Workers](/categories/queues)

sunkan/percurri
===============

Simple client for taking to beanstlakd server

04PHP

Since Nov 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/sunkan/percurri)[ Packagist](https://packagist.org/packages/sunkan/percurri)[ RSS](/packages/sunkan-percurri/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Percurri
========

[](#percurri)

Installation
------------

[](#installation)

The preferred method of installing this library is with [Composer](https://getcomposer.org/) by running the following from your project root:

```
$ composer require sunkan/percurri

```

Using
-----

[](#using)

### Simple example

[](#simple-example)

```
$connection = new Percurri\Connection($host, $port);
$logger = new Psr3Logger();

$workerClient = new Percurri\WorkerClient($connection, $logger);
$producerClient = new Percurri\ProducerClient($connection, $logger);

$data = 'test data';
$tube = 'test-tube';

$producerClient->tube($tube)->put($data);

$workerClient->watch($tube);
$job = $workerClient->reserve();

//do job

//then delete from beanstalkd
$workerClient->delete($job);
```

Api
---

[](#api)

### Connection

[](#connection)

#### Constructor

[](#constructor)

```
Connection(string $host, int $port = 11300, bool $persistent = true, int $timeout = 1)

```

#### Connecting related functions

[](#connecting-related-functions)

```
connect(): bool
disconnect(): bool
isConnected(): bool

```

#### Read from socket.

[](#read-from-socket)

If length is specified reads that amount from buffer otherwise looks for first newline Returns raw string from buffer

```
read($length = null): string

```

#### Write to socket

[](#write-to-socket)

You can specify a format if you want a payload formatted a specific way. Like this: `write('put', $payload, "%d %d %d %d\r\n%s");`

```
write(string $command, array $payload, string $format = null): int

```

### Producer client

[](#producer-client)

#### Constructor

[](#constructor-1)

Logger must be an instance of a Psr3 compatible logger

```
__construct(Connection $connection, LoggerInterface $logger)

```

#### Put

[](#put)

Priority is specified with `0` being most important and `4294967295` least important

If no tube have been selected it puts job in to `default` tube

```
put(string $data, int $pri = 100, int $delay = 0, int $ttr = 30): int

```

#### Select tube

[](#select-tube)

```
tube(string $tube): self

```

#### Get current tube

[](#get-current-tube)

```
currentTube(): string|bool

```

#### Pause tube

[](#pause-tube)

Prevent workers from reserving any new job in tube for `delay` seconds

```
pause(string $tube, int $delay): bool

```

### Worker client

[](#worker-client)

#### Constructor

[](#constructor-2)

Logger must be an instance of a Psr3 compatible logger

```
__construct(Connection $connection, LoggerInterface $logger, Factory $jobFactory, DecoderInterface $decoder)

```

#### Watch tube

[](#watch-tube)

Select tubes to watch. Returns number of tubes in watch list

```
watch(string $tube): int

```

#### Ignore tube

[](#ignore-tube)

Remove tube from watch list

```
ignore(string $tube): int|false

```

#### List tubes watched

[](#list-tubes-watched)

```
listTubes(): array

```

#### Reserve job

[](#reserve-job)

If timeout is specified will only wait that long for a job

```
reserve(int $timeout = null): JobInterface

```

#### Delete job

[](#delete-job)

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
delete($idOrJob): bool

```

#### Release job

[](#release-job)

Puts a reserved job back into the ready queue.

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
release($idOrJob, int $pri, int $delay): bool

```

#### Bury job

[](#bury-job)

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
bury($idOrJob, int $pri): bool

```

#### Touch job

[](#touch-job)

Worker request more time to work on job

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
touch($idOrJob, int $pri): bool

```

#### Peek job

[](#peek-job)

Look at job but don't reserves it

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
peek($idOrJob): JobInterface

```

#### Peek ready queue

[](#peek-ready-queue)

```
peekReady(): JobInterface

```

#### Peek delayed job

[](#peek-delayed-job)

```
peekDelayed(): JobInterface

```

#### Peek buried queue

[](#peek-buried-queue)

```
peekBuried(): JobInterface

```

#### Kick job from buried queue

[](#kick-job-from-buried-queue)

`bound` number of jobs to kick into ready queue

```
kick(int $bound): int

```

#### Kick job

[](#kick-job)

Kick job into ready queue

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
kickJob($idOrJob): JobInterface

```

### Stats client

[](#stats-client)

#### Constructor

[](#constructor-3)

Logger must be an instance of a Psr3 compatible logger

```
__construct(Connection $connection, LoggerInterface $logger, DecoderInterface $decoder)

```

#### Stats about job

[](#stats-about-job)

`idOrJob` can either be an instance of `JobInterface` or an `integer`

```
statsJob($idOrJob): array

```

#### Stats about tube

[](#stats-about-tube)

```
statsTube(string $tube): array

```

#### Stats about system

[](#stats-about-system)

```
stats(): array

```

#### List available tubes

[](#list-available-tubes)

```
listTubes(): array

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce9d40996574fd1f18f69556c872c6eb94e59977c5f0b33c9df541d82fbb3800?d=identicon)[sunkan](/maintainers/sunkan)

### Embed Badge

![Health badge](/badges/sunkan-percurri/health.svg)

```
[![Health](https://phpackages.com/badges/sunkan-percurri/health.svg)](https://phpackages.com/packages/sunkan-percurri)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2238.8M171](/packages/react-async)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
