dvomaks/laravel-sendpulse

Laravel 5 中设置和使用 SendPulse PHP 库的最小服务提供程序

dev-master 2021-11-29 17:14 UTC

This package is auto-updated.

Last update: 2024-09-29 05:49:04 UTC


README

CircleCI

一个服务提供程序和外观,用于在 Laravel 5 中设置和使用 SendPulse PHP 库。

此包包含一个服务提供程序,它将初始化的 SendPulse 客户端实例绑定到 IoC 容器,并包含一个 SendPulse 外观,因此您可以通过以下语法访问 Sendpulse\RestAPI\ApiClient 类的所有方法:

$message = ['title' => 'My first notification', 'website_id' => 1, 'body' => 'I am the body of the push message'];

SendPulse::createPushTask($message);

您应参考 SendPulse API 和其下层的 SendPulseApi PHP 类 以获取所有可用方法的详细信息。

设置

  1. 安装 'dvomaks/laravel-sendpulse' 包

    注意,这将同时安装所需的 sendpulse/rest-api 包。

    $ composer require dvomaks/laravel-sendpulse dev-master
  2. 更新 'config/app.php'

    # Add `SendPulseLaravelServiceProvider` to the `providers` array
    'providers' => array(
        ...
        'Dvomaks\LaravelSendPulse\SendPulseServiceProvider',
    )
    
    # Add the `SendPushFacade` to the `aliases` array
    'aliases' => array(
        ...
        'SendPulse' => 'Dvomaks\LaravelSendPulse\SendPulseFacade',
    )
  3. 发布配置文件(在配置目录中创建 sendpulse.php)并添加您的 API 密钥和可选默认设置。

    $ php artisan vendor:publish