Code Monkey home page Code Monkey logo

laravel-push-notification's Introduction

laravel-push-notification

Based off of https://github.com/davibennun/laravel-push-notification with support for Laravel 5 and 5.1.

Installation

Update your composer.json file to include this package as a dependency

"witty/laravel-push-notification": "dev-master"

Register the PushNotification service provider by adding it to the providers array in the config/app.php file.

'providers' => array(
    'Witty\LaravelPushNotification\PushNotificationServiceProvider'
)

Alias the PushNotification facade by adding it to the aliases array in the config/app.php file.

'aliases' => array(
	'PushNotification'      => 'Witty\LaravelPushNotification\PushNotification',
)

Configuration

Copy the config file into your project by running

php artisan vendor:publish

This will generate a config file like this

array(
    'iOS'     => [
        'environment' => env('IOS_PUSH_ENV', 'development'),
        'certificate' => env('IOS_PUSH_CERT', __DIR__ . '/ios-push-notification-certificates/development/certificate.pem'),  
        'passPhrase'  => env('IOS_PUSH_PASSWORD', '291923Job'),
        'service'     => 'apns'
    ],

    'android' => [
        'environment' => env('ANDROID_PUSH_ENV', 'development'),
        'apiKey'      => env('ANDROID_PUSH_API_KEY', 'yourAPIKey'),
        'service'     => 'gcm'
    ]
);

Where all first level keys corresponds to an service configuration, each service has its own properties, android for instance have apiKey and IOS uses certificate and passPhrase. You can set as many services configurations as you want, one for each app. A directory with the name 'ios-push-notification-certificates' will be added to the config folder for you to store both development and production certificates.

Dont forget to set service key to identify iOS 'service'=>'apns' and Android 'service'=>'gcm'

Usage

PushNotification::app('iOS')
                ->to($deviceToken)
                ->send('Hello World, i`m a push message');

laravel-push-notification's People

Contributors

larkinwhitaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laravel-push-notification's Issues

Bulk push

Can we send notification to multiple device ?
If yes then how ?( syntax for sending to multiple device )

Larval 5.2 Compatibility.

I'm curious if it's known if this package supports Laravel 5.2 or not.
I'm attempting to upgrade from 5.1 to 5.2 and I'm getting dependency issues relating to illuminate/support.

  • witty/laravel-push-notification dev-master requires illuminate/support 5.0.* | 5.1.* -> satisfiable by laravel/framework[v5.1.31], illuminate/support[v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.6, v5.1.8].

Human readable response ?

Hi!

Im using this package with the Laravel 5.2 for from asachanfbd/laravel-push-notification but I dont really know how to get the response after sending the push.

Documentation tells me that this is how it should be used

PushNotification::app('iOS')
                ->to($deviceToken)
                ->send('Hello World, i`m a push message');

And I do get pushes both on iOS as in Android devices but I would like to understand the response format and how can I know if there was some error or not.

Is there any docs on the response format?

GCM with iOS

Hello, is it possible to use GCM service to send notifications on iOS devices with this package? Since, google now has GCM support for iOS.

OS

Just iOS and Android? No Windows Phone?

Push notification is not being delivered to device

I have followed all steps for configuring the package but I am unable to receive notification on apple device. Here is my server code to send notification;
$pn = PushNotification::app('iOS')->to('b2ae8b68fff1fbbe957b8b8f703744794d89f09d45f69b2d847a26c3b064e268')->send('Hello');
dd($pn); // just printed out see whats going on with push manager
Here is the dd() function output;
screen shot 2016-08-22 at 4 26 43 pm
I have added correct certificates for push as well in config file. I really don't get why it is not being delivered.

Sending push notification with other parameters

How to send key value pairs with alert message. I want to send other params with notification message. How to send this options? I want to send custom payload. Is it possible with this library?

Unable to connect

Hello,

I tried to use this package for iOs push notification and i got this error Unable to connect: tls://gateway.sandbox.push.apple.com:2195: 2 (stream_socket_client(): Unable to set local cert chain file "path_url/config/ios-push-notification-certificates/production/certificate.pem"; Check that your cafile/capath settings include details of your certificate and its issuer) and when I tried to run the command root@server ~ # telnet gateway.sandbox.push.apple.com 2195 it connected successfully
Connected to gateway.sandbox.push.apple.com.

Thanks,
Noel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.