PHPackages                             skolodyazhnyy/butter-amqplib - 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. skolodyazhnyy/butter-amqplib

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

skolodyazhnyy/butter-amqplib
============================

Butter AMQP library for PHP, written purely in PHP

0.1.0(9y ago)471MITPHP

Since Sep 17Pushed 7y ago2 watchersCompare

[ Source](https://github.com/skolodyazhnyy/butter-amqplib)[ Packagist](https://packagist.org/packages/skolodyazhnyy/butter-amqplib)[ Docs](https://github.com/skolodyazhnyy/butter-amqplib)[ RSS](/packages/skolodyazhnyy-butter-amqplib/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

Butter AMQP
===========

[](#butter-amqp)

[![Build Status](https://camo.githubusercontent.com/5421f9593f773aab51456c89e3ba5924fc7e285bf66a529fcaebc033f95cd898/68747470733a2f2f7472617669732d63692e6f72672f736b6f6c6f6479617a686e79792f6275747465722d616d71706c69622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/skolodyazhnyy/butter-amqplib)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0790e9e92c7b6a7ac5e7ec28bc08dc608891cd626094b9e0fb5b6d092bd97471/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736b6f6c6f6479617a686e79792f6275747465722d616d71706c69622f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/skolodyazhnyy/butter-amqplib/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/207953a982d726d4a7a958e2195bb608e0e26a0dcac8d7151ecd79ebf1ddce22/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736b6f6c6f6479617a686e79792f6275747465722d616d71706c69622f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/skolodyazhnyy/butter-amqplib/?branch=master)

Butter AMQP is a client library for AMQP protocol purely implemented in PHP. It has no dependencies on any PHP extension nor other PHP packages. It's very light-weight and lightning fast.

Butter AMQP supports all base AMQP features and RabbitMQ extensions, including: [exchange to exchange bindings](https://www.rabbitmq.com/e2e.html), [publisher acknowledgments](https://www.rabbitmq.com/confirms.html), [negative acknowledgements](https://www.rabbitmq.com/nack.html) and others.

Key features
------------

[](#key-features)

- Pure PHP implementation of AMQP protocol: no special requirements for PHP and easy upgrade using just composer
- Easy to use functional API, it hides implementation details and reduce risk of making mistake
- Code generator for frame encoding and decoding helps achieve high performance and low memory usage
- Clean design makes it pleasure to work with AMQP, easy to tests and understand
- Full support for AMQP protocol version 0.9.1 and RabbitMQ extensions

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

[](#installation)

Easiest way to start using Butter AMQP library is to install it using [composer](https://getcomposer.org/doc/00-intro.md#introduction). It has almost no dependencies and does not conflict with any other library.

Open a command console, enter your project directory and execute the following command to download the latest version of this library.

```
$ composer require skolodyazhnyy/butter-amqplib dev-master
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Usage
-----

[](#usage)

If you are new to AMQP, I suggest you have a look into [RabbitMQ tutorial](docs/rabbit-tutorial/tutorial-one.md) which explains all features of AMQP protocol in only 6 chapters tutorial! I have adopted it with code samples for Butter AMQP.

Every code snippet below extends previous one.

### Connecting to the server

[](#connecting-to-the-server)

Establish connection to the server and open a channel.

```
use ButterAMQP\ConnectionBuilder;

$connection = ConnectionBuilder::make()
    ->create("//guest:guest@localhost/%2f");

$channel = $connection->channel(1);
```

[Read more](/docs/connecting.md)

### Define topology

[](#define-topology)

Declare exchanges and queues.

```
use ButterAMQP\ExchangeInterface as Exchange;
use ButterAMQP\QueueInterface as Queue;

$channel->exchange('butter')
    ->define(Exchange::TYPE_FANOUT, Exchange::FLAG_DURABLE);

$channel->queue('butter')
    ->define(Queue::FLAG_DURABLE | Queue::FLAG_EXCLUSIVE)
    ->bind('butter');
```

[Read more](/docs/topology.md)

### Publishing messages

[](#publishing-messages)

Publish a message to newly declared exchange and it will be delivered to the queue.

```
use ButterAMQP\Message;

// Construct a message to be published
$message = new Message('hi there', ['content-type' => 'text/plain']);

// Publish message to default exchange, with routing key "text-messages".
$channel->publish($message, '', 'text-messages');
```

[Read more](/docs/publishing.md)

### Consuming messages

[](#consuming-messages)

Receive your message and acknowledge its delivery.

```
use ButterAMQP\Delivery;

// Declare consumer
$consumer = $channel->consume('text-messages', function(Delivery $delivery) {
    echo "Receive a message: " . $delivery->getBody() . PHP_EOL;

    // Acknowledge delivery
    $delivery->ack();
});

// Serve connection until consumer is cancelled
while($consumer->isActive()) {
    $connection->serve();
}
```

[Read more](/docs/consuming.md)

### Close connection

[](#close-connection)

Properly closing connection to the server will guarantee all temporary queues will be deleted and resources released.

You don't need to close channels, just connection will be enough.

```
$connection->close();
```

Known issues
------------

[](#known-issues)

- Decimal type is not supported
- Unsigned long long type is not supported

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3524d ago

### Community

Maintainers

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

---

Top Contributors

[![skolodyazhnyy](https://avatars.githubusercontent.com/u/576301?v=4)](https://github.com/skolodyazhnyy "skolodyazhnyy (11 commits)")

---

Tags

AMQPAMQPLib

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/skolodyazhnyy-butter-amqplib/health.svg)

```
[![Health](https://phpackages.com/badges/skolodyazhnyy-butter-amqplib/health.svg)](https://phpackages.com/packages/skolodyazhnyy-butter-amqplib)
```

###  Alternatives

[php-amqplib/rabbitmq-bundle

Integrates php-amqplib with Symfony &amp; RabbitMq. Formerly emag-tech-labs/rabbitmq-bundle, oldsound/rabbitmq-bundle.

1.3k20.1M65](/packages/php-amqplib-rabbitmq-bundle)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[swarrot/swarrot

A simple lib to consume RabbitMQ queues

3654.4M8](/packages/swarrot-swarrot)[prolic/humus-amqp

PHP-AMQP library with RabbitMQ Extensions

76205.4k5](/packages/prolic-humus-amqp)[hyperf/amqp

A amqplib for hyperf.

241.2M56](/packages/hyperf-amqp)[workerman/rabbitmq

Asynchronous rabbitmq client for PHP based on workerman.

4313.4k6](/packages/workerman-rabbitmq)

PHPackages © 2026

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