PHPackages                             wangchengtao/laravel-amqp - 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. wangchengtao/laravel-amqp

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

wangchengtao/laravel-amqp
=========================

AMQP wrapper for Laravel to publish and consume messages

01PHP

Since Apr 30Pushed 1y agoCompare

[ Source](https://github.com/wangchengtao/laravel-amqp)[ Packagist](https://packagist.org/packages/wangchengtao/laravel-amqp)[ RSS](/packages/wangchengtao-laravel-amqp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

wangchengtao/laravel-amqp
=========================

[](#wangchengtaolaravel-amqp)

forked from [bschmitt/laravel-amqp](https://github.com/bschmitt/laravel-amqp)

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

[](#installation)

```
$ php composer require wangchengtao/laravel-amqp

```

Publishing a message
--------------------

[](#publishing-a-message)

### Push message with routing key

[](#push-message-with-routing-key)

```
    Amqp::publish('routing-key', 'message');
```

### Push message with routing key and create queue

[](#push-message-with-routing-key-and-create-queue)

```
    Amqp::publish('routing-key', 'message' , ['queue' => 'queue-name']);
```

### Push message with routing key and overwrite properties

[](#push-message-with-routing-key-and-overwrite-properties)

```
    Amqp::publish('routing-key', 'message' , ['exchange' => 'amq.direct']);
```

Consuming messages
------------------

[](#consuming-messages)

### Consume messages, acknowledge and stop when no message is left

[](#consume-messages-acknowledge-and-stop-when-no-message-is-left)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

   $resolver->stopWhenProcessed();

});
```

### Consume messages forever

[](#consume-messages-forever)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

});
```

### Consume messages, with custom settings

[](#consume-messages-with-custom-settings)

```
Amqp::consume('queue-name', function ($message, $resolver) {

   var_dump($message->body);

   $resolver->acknowledge($message);

}, [
	'timeout' => 2,
	'vhost'   => 'vhost3'
]);
```

Fanout example
--------------

[](#fanout-example)

### Publishing a message

[](#publishing-a-message-1)

```
\Amqp::publish('', 'message' , [
    'exchange_type' => 'fanout',
    'exchange' => 'amq.fanout',
]);
```

### Consuming messages

[](#consuming-messages-1)

```
\Amqp::consume('', function ($message, $resolver) {
    var_dump($message->body);
    $resolver->acknowledge($message);
}, [
    'routing' => '',
    'exchange' => 'amq.fanout',
    'exchange_type' => 'fanout',
    'queue_force_declare' => true,
    'queue_exclusive' => true,
    'persistent' => true // required if you want to listen forever
]);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/2401b92a15ab0ec8abf74a063fd79206aa50dc5ff912c653171127474bcd78d0?d=identicon)[wangchengtao](/maintainers/wangchengtao)

---

Top Contributors

[![bschmitt](https://avatars.githubusercontent.com/u/239644?v=4)](https://github.com/bschmitt "bschmitt (55 commits)")[![mirkojotic](https://avatars.githubusercontent.com/u/10652272?v=4)](https://github.com/mirkojotic "mirkojotic (6 commits)")[![petekelly](https://avatars.githubusercontent.com/u/1177933?v=4)](https://github.com/petekelly "petekelly (6 commits)")[![stevenklar](https://avatars.githubusercontent.com/u/379650?v=4)](https://github.com/stevenklar "stevenklar (5 commits)")[![SpaceK33z](https://avatars.githubusercontent.com/u/533616?v=4)](https://github.com/SpaceK33z "SpaceK33z (4 commits)")[![ni-bschmitt](https://avatars.githubusercontent.com/u/58559970?v=4)](https://github.com/ni-bschmitt "ni-bschmitt (4 commits)")[![jwkblades](https://avatars.githubusercontent.com/u/517211?v=4)](https://github.com/jwkblades "jwkblades (3 commits)")[![Cellard](https://avatars.githubusercontent.com/u/1220316?v=4)](https://github.com/Cellard "Cellard (3 commits)")[![junaidnasir](https://avatars.githubusercontent.com/u/10703810?v=4)](https://github.com/junaidnasir "junaidnasir (3 commits)")[![xaviapa](https://avatars.githubusercontent.com/u/8439057?v=4)](https://github.com/xaviapa "xaviapa (3 commits)")[![smartyaunt](https://avatars.githubusercontent.com/u/12381885?v=4)](https://github.com/smartyaunt "smartyaunt (2 commits)")[![joskfg](https://avatars.githubusercontent.com/u/524887?v=4)](https://github.com/joskfg "joskfg (2 commits)")[![Pe46dro](https://avatars.githubusercontent.com/u/6197075?v=4)](https://github.com/Pe46dro "Pe46dro (2 commits)")[![josemanuel-cardona](https://avatars.githubusercontent.com/u/196229448?v=4)](https://github.com/josemanuel-cardona "josemanuel-cardona (2 commits)")[![hertzigger](https://avatars.githubusercontent.com/u/4991108?v=4)](https://github.com/hertzigger "hertzigger (2 commits)")[![MattBearson](https://avatars.githubusercontent.com/u/17829867?v=4)](https://github.com/MattBearson "MattBearson (1 commits)")[![alupuleasa](https://avatars.githubusercontent.com/u/26110108?v=4)](https://github.com/alupuleasa "alupuleasa (1 commits)")[![dennisgon](https://avatars.githubusercontent.com/u/6257311?v=4)](https://github.com/dennisgon "dennisgon (1 commits)")[![du-disk](https://avatars.githubusercontent.com/u/30786664?v=4)](https://github.com/du-disk "du-disk (1 commits)")[![emil-nasso](https://avatars.githubusercontent.com/u/1119706?v=4)](https://github.com/emil-nasso "emil-nasso (1 commits)")

### Embed Badge

![Health badge](/badges/wangchengtao-laravel-amqp/health.svg)

```
[![Health](https://phpackages.com/badges/wangchengtao-laravel-amqp/health.svg)](https://phpackages.com/packages/wangchengtao-laravel-amqp)
```

###  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)
