Package Data | |
---|---|
Maintainer Username: | garethtdavies |
Maintainer Contact: | hello@garethtdavies.com (Gareth Davies) |
Package Create Date: | 2016-01-19 |
Package Last Update: | 2020-02-19 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 03:02:44 |
Package Statistics | |
---|---|
Total Downloads: | 4,347 |
Monthly Downloads: | 5 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 1 |
Total Forks: | 3 |
Total Open Issues: | 1 |
A service provider and facade to set up and use the SendPulse PHP library in Laravel 5.
This package consists of a service provider, which binds an instance of an initialized SendPulse client to the IoC-container and a SendPulse facade so you may access all methods of the SendpulseApi class via the syntax:
$message = ['title' => 'My first notification', 'website_id' => 1, 'body' => 'I am the body of the push message'];
SendPulse::createPushTask($message);
You should refer to the SendPulse API and underlying SendPush PHP class for full details about all available methods.
Install the 'wensleydale/sendpulse-laravel' package
Note, this will also install the required wensleydale/sendpulse-rest-api-php package.
$ composer require wensleydale/sendpulse-laravel:1.*
Update 'config/app.php'
# Add `SendPulseLaravelServiceProvider` to the `providers` array
'providers' => array(
...
'SendPulse\SendPulseLaravel\SendPulseLaravelServiceProvider',
)
# Add the `SendPushFacade` to the `aliases` array
'aliases' => array(
...
'SendPulse' => 'SendPulse\SendPulseLaravel\SendPulseFacade',
)
Publish the configuration file (creates sendpulse.php in config directory) and add your API keys and optional default settings.
$ php artisan vendor:publish
If you do not wish to make use of the SendPulse facade you may simply "type-hint" the SendPulse dependency in the constructor of a class that is resolved by the IoC container and an instantiated client will be ready for use.
use SendPulse\SendpulseApi;
private $client;
public function __construct(SendpulseApi $client)
{
$this->client = $client;
}
public function getWebsites()
{
$this->client->pushListWebsites();
}