Skip to content

tzsk/push

Repository files navigation

push

Latest Version on Packagist Software License Code Climate Quality Score Total Downloads

This is a Laravel 5 Package for Pushwoosh Notification Integration. This package currently supports IOS & Android other support is coming soon. This package is built upon gomoob/php-pushwoosh package. With feew changes and Laravel 5 Compatibility.

This package is compatible with Laravel 5.2 or Higher. Old version support (Laravel 5.1.*) is coming soon for those who are still using PHP 5.4.*

Install

Via Composer

$ composer require tzsk/push

Configure

config/app.php

'providers' => [
    ...
    Tzsk\Push\Provider\PushServiceProvider::class,
    ...
],

'aliases' => [
    ...
    'Push' => Tzsk\Push\Facade\Push::class,
    ...
],

To publish the Configuration file in config/push.php Run:

php artisan vendor:publish

Usage

use Tzsk\Push\Facade\Push;
...
$response = Push::send("Message Text", function($push) {
    $push->setToken("Device Token");
    # OR...
    $push->setTokens(["Device 1", "Device 2"])
        ->setTitle("You have a new notification") # For Android.
        ->setBody("Message Text") # To override the Message. Optional.
        ->setBadge(1) # Default: 1.
        ->setPayload(["type" => "ANYTHING", "data" => [] ]) # Default: []
        ->setIcon("http://path/to/icon.png") # For Android.
        ->setSmallIcon("pw_notification.png") # For Android.
        ->setBanner("http://path/to/banner.png") # For Android. Optional.
        ->setSound("res/sound/file/path") # Default: "default"
        ->setPriority(1) # Default: 1 
        ->setVibration(1) # Default: 1
        ->setIbc("#ffffff"); # Icon Background Color. Default: '#ffffff'
});

if ($response->isOk()) {
    # Successfully Sent.
} else {
    # Something went wrong.
    echo $response->getStatusMessage(); # Get failure message.
}
...

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email mailtokmahmed@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.