PHPackages                             l-queue/l-client - 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. l-queue/l-client

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

l-queue/l-client
================

A nats or redis queue client in PHP

v0.0.6(8y ago)0280MITPHP

Since Jan 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/xxlixin1993/QueueClient)[ Packagist](https://packagist.org/packages/l-queue/l-client)[ RSS](/packages/l-queue-l-client/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Introduction
============

[](#introduction)

A nats or redis queue client in PHP

Install
=======

[](#install)

```
composer require l-queue/l-client

```

Basic Usage
===========

[](#basic-usage)

```
$natsClient = \LQueue\Factory::getQueue('nats');
$natsClient->driver();
$natsClient->publish('FOO', 'bar', 11);

```

Nats Client
===========

[](#nats-client)

NATS is an open-source, cloud-native messaging system. In addition to functioning as the “nervous system” for the Apcera platform, companies like Baidu, Siemens, VMware, HTC, and Ericsson rely on NATS for its highly performant and resilient messaging capabilities.

Nats Queue
----------

[](#nats-queue)

This library supported publish,request and subscribe function.

### pub

[](#pub)

```
$natsClient = \LQueue\Factory::getQueue('nats');
$natsClient->driver();
$natsClient->publish('FOO', 'bar', 11);
$natsClient->close();

```

### subscribe

[](#subscribe)

```
$natsClient = \LQueue\Factory::getQueue('nats');
$natsClient->driver();
$natsClient->subscribe('FOO', function ($response) {
    printf("Data: %s\r\n", $response->getBody());
});
$natsClient->close();

```

### pubsub

[](#pubsub)

```
$natsClient = \LQueue\Factory::getQueue('nats');
$natsClient->driver();
$natsClient->subscribe('FOO', function ($response) {
    printf("Data: %s\r\n", $response->getBody());
});

$natsClient->publish('FOO', 'bar');

// Wait for 1 message.
$natsClient->wait(1);
$natsClient->close();

```

### request

[](#request)

```
$natsClient = \LQueue\Factory::getQueue('nats');
// set username and password when you config the nats
$natsClient->getConnectOption()->setUser('derek')->setPass('T0pS3cr3t')->setPort(4242);
$natsClient->driver();
$sid = $natsClient->subscribe(
    'foo',
    function ($response) {
        $response->reply('Reply: Hello, ' . $response->getBody() . ' ^_^!');
    }
);

$natsClient->request(
    'foo',
    'bar',
    function ($response) {
        echo $response->getBody();
    }
);
$natsClient->close();

```

Nats Option
-----------

[](#nats-option)

Configure some parameters

### username and password

[](#username-and-password)

```
$natsClient->getConnectOption()->setUser('derek')->setPass('T0pS3cr3t')

```

### host port

[](#host-port)

```
$natsClient->getConnectOption()->setHost('127.0.0.1')->setPort(4242);

```

### timeout

[](#timeout)

```
// wait for 10s,then close the connection
$natsClient->getConnectOption()->setTimeout(10)

```

Redis Queue Client
==================

[](#redis-queue-client)

Just packaging some redis function.

Redis Queue
-----------

[](#redis-queue)

### publish

[](#publish)

```
$redisClient = \LQueue\Factory::getQueue('redis');
$option = $redisClient->getConnectOption()->setPass('123456');
$redisClient->driver();
$redisClient->publish('FOO', 'bar');
$redisClient->close();

```

### Enter the queue use lpush

[](#enter-the-queue-use-lpush)

```
$redisClient = \LQueue\Factory::getQueue('redis');
$option = $redisClient->getConnectOption()->setPass('123456');
$redisClient->driver();
$redisClient->enQueue('FOO', 'bar');
$redisClient->close();

```

Redis Option
------------

[](#redis-option)

Configure some parameters

### password

[](#password)

```
$redisClient = \LQueue\Factory::getQueue('redis');
$option = $redisClient->getConnectOption()->setPass('123456');

```

### host port

[](#host-port-1)

```
$redisClient->getConnectOption()->setHost('127.0.0.1')->setPort(4242);

```

### timeout

[](#timeout-1)

```
// wait for 10s,then close the connection
$redisClient->getConnectOption()->setTimeout(10)

```

License
=======

[](#license)

MIT

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~0 days

Total

6

Last Release

3099d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12002027?v=4)[Lx](/maintainers/xxlixin1993)[@xxlixin1993](https://github.com/xxlixin1993)

---

Top Contributors

[![xxlixin1993](https://avatars.githubusercontent.com/u/12002027?v=4)](https://github.com/xxlixin1993 "xxlixin1993 (43 commits)")

---

Tags

queue

### Embed Badge

![Health badge](/badges/l-queue-l-client/health.svg)

```
[![Health](https://phpackages.com/badges/l-queue-l-client/health.svg)](https://phpackages.com/packages/l-queue-l-client)
```

###  Alternatives

[php-amqplib/php-amqplib

Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.

4.6k129.9M974](/packages/php-amqplib-php-amqplib)[ramsey/collection

A PHP library for representing and manipulating collections.

1.2k513.6M83](/packages/ramsey-collection)[queue-interop/queue-interop

Promoting the interoperability of MQs objects. Based on Java JMS

48131.3M95](/packages/queue-interop-queue-interop)[phootwork/collection

The phootwork library fills gaps in the php language and provides better solutions than the existing ones php offers.

3927.1M15](/packages/phootwork-collection)[apinstein/jqjobs

Async job manager for PHP.

3220.2k](/packages/apinstein-jqjobs)

PHPackages © 2026

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