Giter Club home page Giter Club logo

laravel-mns's Introduction

Laravel-MNS

StyleCI PSR2 Build Status Code Coverage Latest Stable Version License

阿里云消息服务(MNS)的 Laravel 适配,本质上是为 Laravel 的队列增加 MNS 驱动。包含了阿里云 MNS SDK,为了 Laravel 能透明的使用 MNS 而对其作必要的引用。

没测试这个包是否能在小于 5.1 下工作。 已测试支持 >= 5.0。

chefxu/aliyun_mns 之上修改而来,鉴于缩进、换行和文件命名等代码风格有所差异,无法发 pr。

阿里云 MNS SDK 不支持 Composer,直接将其包含在版本库中,并注册到 AliyunMNS 命名空间下。

安装使用

通过 Composer 安装:

$ composer require abe/laravel-mns

之后在 config/queue.php 中增加 mns 配置:

'connections' => [
    'redis' => [
        'driver'     => 'redis',
        'connection' => 'default',
        'queue'      => 'default',
        'expire'     => 60,
    ],

    // 新增阿里云 MNS。
    'mns'   => [
        'driver'   => 'mns',
        'key'      => env('MNS_ACCESS_KEY', 'access-key'),
        'secret'   => env('MNS_SECRET_KEY', 'secret-key'),
        // 外网连接必须启用 https。
        'endpoint' => 'your-endpoint',
        'queue'    => env('MNS_DEFAULT_QUEUE', 'default-queue-name'),
    ],
],

并且在你常用的 ServiceProvider 中注册队列驱动:

Queue::extend('mns', function()
{
    return new \LaravelMns\Connectors\MnsConnector();
});

正常使用 Laravel Queue 即可:

https://laravel.com/docs/5.2/queues

许可

MIT

laravel-mns's People

Contributors

abrahamgreyson avatar chefxu avatar scrutinizer-auto-fixer 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.