notifymehq/laravel5

此包已被弃用且不再维护。作者建议使用 notifymehq/laravel 包。

为 notifyme 提供 Laravel 桥接器

dev-master / 1.0.x-dev 2016-06-07 08:41 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:43:45 UTC


README

这是 NotifyMe 的 Laravel 5 桥接器。

安装

需要 PHP 5.5+ 或 HHVM 3.6+。

要获取 NotifyMe Laravel 的最新版本,只需使用 Composer 引入项目。

$ composer require notifymehq/laravel

当然,您也可以手动更新 require 块并运行 composer update

{
    "require": {
        "notifymehq/laravel": "^1.0"
    }
}

请注意,安装此包仅引入基本内容,不会提供任何适配器。您可以单独引入适配器,或者引入整个包(notifymehq/notifyme)。

将服务提供者添加到 app.php

'providers' => [
    // ...
    'NotifyMeHQ\Laravel\NotifyMeServiceProvider',
],

如果您想使用 Facade,也请添加别名

'aliases' => [
    // ...
    'NotifyMe'  => 'NotifyMeHQ\Laravel\Facades\NotifyMe',
],

安装配置文件。

$ php artisan config:publish

配置您的连接。

return [
    'default' => 'slack',
    'connections' => [
        'slack' => [
            'driver' => 'slack',
            'from'   => 'notifyme',
            'token'  => 'your-token',
        ],
        'webhook' => [
            'driver' => 'webhook',
        ],
    ],
];

使用方法

$response = NotifyMe::notify('#tests', 'This is working awesome!');

echo $response->isSent() ? 'Message sent' : 'Message going nowhere';
$response = NotifyMe::connection('slack')->notify('#tests', 'This is working awesome!');

echo $response->isSent() ? 'Message sent' : 'Message going nowhere';

有关使用方法的更多信息,请访问 NotifyMe

许可

NotifyMe 在 MIT 许可证 (MIT) 下授权。