Laravel 5 Pushover.net Package
, (*1)
A Laravel 5 package for Android and iOS push notification service from https://pushover.net/., (*2)
**Please if you found any bug or you have any enhancement, You're so welcomed to open an Issue or make a pull request., (*3)
Content
Installation
If you still using laravel 4.1 use the 1.3.0 version, (*4)
To get the latest version of dyaa/pushover simply require it in your composer.json
file., (*5)
"dyaa/pushover": "dev-master"
After that, you'll need to run composer update
to download the latest Version and updating the autoloader., (*6)
Or, (*7)
composer require dyaa/pushover:dev-master
Once dyaa/pushover is installed, you need to register the Service Provider. To do that open app/config/app.php
and add the following to the providers
key., (*8)
'Dyaa\Pushover\PushoverServiceProvider',
Next you add this facade to app/config/app.php
, (*9)
'Dyaa\Pushover\Facades\Pushover',
To use this in your L5 application:, (*10)
use Dyaa\Pushover\Facades\Pushover;
Configuration
Create app/config/pushover.php
and fill it with your Token and the User Key from https://pushover.net/, (*11)
return [
'token' => 'App Token',
'user_key' => 'User Key',
];
Usage
Now you can use the package like that:, (*12)
To Set a message (Required), (*13)
Pushover::push($title, $message);
To Set a Link (Optional), (*14)
Pushover::url($url, $title);
To Set a Callback (Optional), (*15)
Pushover::callback($callbackURL);
To Set a Sound (Optional) Supported Notification Sounds https://pushover.net/api#sounds, (*16)
Pushover::sound($sound);
To Set a Device Name (Optional), (*17)
Pushover::device($device);
To Set if the Message should be sent as HTML (Optional) Default is 1, (*18)
Pushover::html($html);
To Set a Timestamp (Optional) Default is time(), (*19)
Pushover::timestamp($timestamp);
To Set Priority (Optional) For More Info about Priority https://pushover.net/api#priority, (*20)
Pushover::priority($priority, $retry, $expire);
To turn the Debug mode (Optional), (*21)
Pushover::debug(true);
To Send the Message (Required), (*22)
Pushover::send();
All other information will be found in details here https://pushover.net/api, (*23)
Commands
In the version 1.2.0 and above it supports the Artisan Commands but first make sure that you've done the Configuration correctly., (*24)
You can run, (*25)
php artisan list
and you'll find, (*26)
pushover
pushover:send Pushover Command
To send a pushover message you'll be able to use it like this way ( Title and Message are Required ), (*27)
php artisan pushover:send YourTitle YourMessage
to turn on the debug mode just add, (*28)
--debug
in the end of the Command line, (*29)
to set a sound you can add "Optional", (*30)
--sound=YourSound
To know the supported sounds from here https://pushover.net/api#sounds, (*31)
to set a Device name "Optional", (*32)
--device=YourDeviceName
to send a URL "Optional", (*33)
--url=http://www.example.com/
to set a title for the URL "Optional", (*34)
--urltitle=UrlTitle
to set a priority Message you can know more about the Priority Messages from here https://pushover.net/api#priority "Optional", (*35)
--priority=1
to set a priority retry (in seconds) Default is 60 "Optional", (*36)
--retry=60
to set a priority expire (in seconds) Default is 356 "Optional", (*37)
--expire=356
to set if message should be sent as HTML. Default is 1 "Optional"
Note: Message body needs to be wrapped in quotes., (*38)
--html=1
License
Copyright (c) 2017 Dyaa Eldin Moustafa Licensed under the [MIT license][2]., (*39)