Package Data | |
---|---|
Maintainer Username: | Mapalagama |
Maintainer Contact: | dev.hasitha@gmail.com (Hasitha Mapalagama) |
Package Create Date: | 2016-07-04 |
Package Last Update: | 2017-06-06 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:11:36 |
Package Statistics | |
---|---|
Total Downloads: | 693 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Urban Airship library for Laravel 5. UAShip
composer require mapalagama/uaship
use Mapalagama\UAShip\UAShip
Initialize UAShip class with your App Key and App Master Secret
$uaShip = new UAShip("**app_key_here**", "**app_master_secret**");
Add alert using addAlert method in UAShip class
$uaShip->addAlert("This is alert");
Add channels using addChannel method. parameters,
UAShip::IOS
for IOS ChannelsUAShip::ANDROID
for Android channels$uaShip->addChannel(UAShip::IOS, "**Channel_id_here**");
$uaShip->addChannel(UAShip::ANDROID, "**Channel_id_here**");
Add extra data using addExtra method. parameters,
$extra = new stdClass();
$extra->question = "what is your name ?";
$uaShip->addExtra($e);
Send notification using send method.
$result = $uaShip->send();
SUCCESS MESSAGE $result
{
"ok": true,
"operation_id": "**operation_id**",
"push_ids": [
"**push_id**"
],
"message_ids": [],
"content_urls": []
}
ERROR MESSAGE $result
error field contains the reason
{
"ok": false,
"error": "Unauthorized",
"error_code": 40101
}
//initialization
$uaShip = new UAShip("**APP_KEY**", "**APP_MASTER_SECRET**");
//add alert message
$uaShip->addAlert("This is alert");
//add channels
$uaShip->addChannel(UAShip::IOS, "**CHANNEL_ID**");
$uaShip->addChannel(UAShip::ANDROID, "**CHANNEL_ID**");
//add extra
$extra = new stdClass();
$extra->question = "what is your name ?";
$uaShip->addExtra($extra);
//send
echo $uaShip->send();
UAShip is released under the MIT License.