Git Product home page Git Product logo

laravel-rabbitmq's Introduction

laravel-rabbitmq

Latest Stable Version Total Downloads Latest Unstable Version License

RabbitMQ driver for Laravel.

Installation

(1) Install this package via composer using:

composer require laborer-by/laravel-rabbitmq

(2) Add these properties to .env with proper values:

;RABBITMQ dev
RABBITMQ_HOST=127.0.0.1
RABBITMQ_PORT=5672
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_VHOST=oc

(3) Create a table:

CREATE TABLE `tmp_rabbitmq_msg` (
  `msg_id` char(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '消息的唯一id',
  `routing_key` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'routing_key 消息的路由键',
  `source` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '消息的来源',
  `msg_data` mediumtext COLLATE utf8_unicode_ci NOT NULL COMMENT '消息的主体数据',
  `extra_data` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '额外的数据',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  UNIQUE KEY `index_msg_id` (`msg_id`) USING BTREE,
  KEY `index_routing_key` (`routing_key`) USING BTREE,
  KEY `index_created_at` (`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='rabbitmq消息表';

Config

Register LaravelRabbitMQServiceProvider via config/app.php:

'providers' => [
    // others ...

    Laborer\LaravelRabbitMQ\LaravelRabbitMQServiceProvider::class,
],

To publish the config file, run the following:

php artisan vendor:publish --provider="Laborer\LaravelRabbitMQ\LaravelRabbitMQServiceProvider"

Changelog

You will find a complete changelog history within the CHANGELOG file.

Testing

Run tests with PHPUnit:

vendor/bin/phpunit

OR

composer test

laravel-rabbitmq's People

Contributors

laborer-by avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.