dvomaks / laravel-sendpulse
Laravel 5 中设置和使用 SendPulse PHP 库的最小服务提供程序
dev-master
2021-11-29 17:14 UTC
Requires
- php: ^7.3|^7.4|^8.0
- illuminate/support: 5.1 - 5.8|^6.0|^7.0|^8.0
- sendpulse/rest-api: 1.*
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-29 05:49:04 UTC
README
一个服务提供程序和外观,用于在 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 类 以获取所有可用方法的详细信息。
设置
-
安装 'dvomaks/laravel-sendpulse' 包
注意,这将同时安装所需的 sendpulse/rest-api 包。
$ composer require dvomaks/laravel-sendpulse dev-master
-
更新 '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', )
-
发布配置文件(在配置目录中创建 sendpulse.php)并添加您的 API 密钥和可选默认设置。
$ php artisan vendor:publish