---
title: Introduction
permalink: /
---
`amphp/beanstalk` is an asynchronous client for [Beanstalk](http://kr.github.io/beanstalkd/).

## Installation

```
composer require amphp/beanstalk
```

## Usage

```php
$beanstalk = new Amp\Beanstalk\BeanstalkClient("tcp://127.0.0.1:11300?tube=foobar");

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

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

---
title: Introduction
permalink: /
---
`amphp/beanstalk` is an asynchronous client for [Beanstalk][beanstalk].

## Installation

```
composer require amphp/beanstalk
```

## Usage

Connecting to a [Beanstalk][beanstalk] server

```php
$beanstalk = new Amp\Beanstalk\BeanstalkClient("tcp://127.0.0.1:11300");
// If you already know the tube you need to connect to, or have a single tube, you
// can connect to the server with an additional tube query parameter.
// $beanstalk = new Amp\Beanstalk\BeanstalkClient("tcp://127.0.0.1:11300?tube=foobar");

$systemStats = $beanstalk->getSystemStats();

$readyJobs = $systemStats->currentJobsReady;
```

[beanstalk]: http://kr.github.io/beanstalkd/

Update readme to change up and expand on the client usage Moving creating jobs to its own page
Update readme to change up and expand on the client usage Moving
creating jobs to its own page

Signed-off-by: Hunter Skrasek <72d5a1f382c911c2a29ef574447e0e11e1dac6c6@me.com>
