承接 romainrg/rabbitmq_client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

romainrg/rabbitmq_client

Composer 安装命令:

composer require romainrg/rabbitmq_client

包简介

CodeIgniter Library for RabbitMQ interactions with CodeIgniter using PHP-AMQPLib

README 文档

README

CodeIgniter Library used to easilly interract with RabbitMQ 🐰❤

📚 Dependencies

  • PHP 5.4+ (with Composer)
  • Rabbit MQ Installed on your server (at least 3.5.*)
  • php-amqplib
  • CodeIgniter Framework (3.1.8+ recommanded)

🔰 Installation

➡️ Step 1 : Library installation by Composer

Just by running following command in the folder of your project :

composer require romainrg/rabbitmq_client

Or by adding following lines to your composer.json file :

"require": {
    "romainrg/rabbitmq_client": "^6.2.0"
},

Don't forget to include your autoload to CI config file :

$config['composer_autoload'] = FCPATH.'vendor/autoload.php';

➡️ Step 2 : Run a composer update in the directory of your project with the following command :

$ composer require romainrg/rabbitmq_client

➡️ Step 3 : Create the following config file

You have to create it in the CI config folder located in ./application/config/rabbitmq.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Config for Rabbit MQ Library
 */
$config['rabbitmq'] = array(
    'host' => 'localhost',     // <- Your Host       (default: localhost)
    'port' => 5672,            // <- Your Port       (default: 5672)
    'user' => 'username',      // <- Your User       (default: guest)
    'pass' => 'password',      // <- Your Password   (default: guest)
    'vhost' => '/',            // <- Your Vhost      (default: /)
    'allowed_methods' => null, // <- Allowed methods (default: null)
    'non_blocking' => false,   // <- Your Host       (default: false)
    'timeout' => 0             // <- Timeout         (default: 0)          
);

➡️ Step 4 : Load the library in your CI Core Controller file

(Or just in a CI Controller)

$this->load->add_package_path(APPPATH . 'third_party/rabbitmq');
$this->load->library('rabbitmq');
$this->load->remove_package_path(APPPATH . 'third_party/rabbitmq');

➡️ Step 5 : Enjoy and give me some improvements or ideas ! ;)

Examples

➡️ Pushing some datas in a Queue:

This will create, if it does not exist, the 'hello_queue' queue and insert 'Hello World !' text inside it.

$this->rabbitmq->push('hello_queue', 'Hello World !');

If you want to run your CI Controller Method with CLI command :

$ php www.mywebsite.com/index.php 'controller' 'method'

You will have the following return

$ [+] Pushing 'Hello World !' to 'hello_queue' -> OK

➡️ Fetching some datas from a Queue (only in CLI at this time):

This will fetch last inserted datas from the 'hello_queue' in real time, with parmanent mode activated and '_process' callback function.

The PHP Code :

return $this->rabbitmq->pull('hello_queue', true, array($this, '_process'));

Run it in CLI :

$ php www.mywebsite.com/index.php 'controller' 'method'

➡️ Pushing some datas in a Queue with additional parameters:

This will create, if it does not exist, the 'hello_queue' queue and insert 'Hello World !' text inside it, the third parameter TRUE set the durability of the 'hello_queue' (TRUE = permanent, FALSE = not permanent), the last parameter 'delivery_mode (2)' makes message persistent (you can also add some parameters to this array).

$this->rabbitmq->push('hello_queue', 'Hello World !', TRUE, array('delivery_mode' => 2));

For more CodeIgniter libraries, give me a 🍺😁

> Beer road

🔒 License

GNU General Public License v3.0

romainrg/rabbitmq_client 适用场景与选型建议

romainrg/rabbitmq_client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.5k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2018 年 10 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「library」 「rabbitmq」 「codeigniter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 romainrg/rabbitmq_client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 romainrg/rabbitmq_client 我们能提供哪些服务?
定制开发 / 二次开发

基于 romainrg/rabbitmq_client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2018-10-24