GithubHelp home page GithubHelp logo

dao12dao / laravel-push-notification-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from larkinwhitaker/laravel-push-notification

0.0 1.0 0.0 148 KB

Laravel 5 Package for sending push notifications to Android and iOS devices

Home Page: http://keystrokecreative.com/

PHP 100.00%

laravel-push-notification-1'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-1's People

Contributors

larkinwhitaker avatar

Watchers

Dao avatar

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.