2017 © Pedro Peláez
 

library gcm

Simple GCM push using Guzzle.

image

matriphe/gcm

Simple GCM push using Guzzle.

  • Wednesday, June 24, 2015
  • by matriphe
  • Repository
  • 3 Watchers
  • 2 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Simple GCM Push Notification

Send GCM Push notification using Guzzle. Make sure you have the GCM Api key and could get Device ID and generate GCM ID., (*1)

Compatibility

Works with Laravel 5.0., (*2)

Installation

Open composer.json and require this line below., (*3)

"matriphe/gcm": "dev-master"

Or you can run this command from your project directory., (*4)

composer require "matriphe/gcm:dev-master"

Laravel Installation

Open the config/app.php and add this line in providers section., (*5)

'Matriphe\Gcm\GcmServiceProvider'

Still in config/app.php, add this line in alias section., (*6)

'Gcm' => 'Matriphe\Gcm\GcmFacade'

Publish Configuration

To control the configuration, you have to publish the configuration file., (*7)

php artisan vendor:publish

After running this command, there will be config/gcm.php and resources/views/vendor/gcm/form.blade.php files., (*8)

Please fill the appKey section in the config/gcm.php., (*9)

Usage

Just use the push($device_id, $gcm_id, $subject, $message, $extras = []) function and it will push the message to GCM., (*10)

The return of the function is object., (*11)

Example

$device_id = '30C89D80C48E96AE';
$gcm_id = 'APA91bGfw8y8DG6CL1BOraVDJyYXUU82rwzbJjnR5PppIcSE7HYgQSvxiSHMJN7zYiCC9CLGNHLiWMxUD22JrlSmvMkaJiUgCsMOvHk0BPeWmvGJu4oHAa1KUm9D5ngdcFNNUwJQ7ttB6VW0F575rhQ2ow56ACM1Yg';
$subject = 'Test Push Subject';
$message = 'This is the message that will be shown in notification.';
$extras = [
    'id' => 21,
    'user' => 'motherfather',
];
Gcm::push($device_id, $gcm_id, $subject, $message, $extras = [])

Output

stdClass Object
(
    [multicast_id] => 6100993858981303466
    [success] => 1
    [failure] => 0
    [canonical_ids] => 0
    [results] => Array
        (
            [0] => stdClass Object
                (
                    [message_id] => 0:1434034071184625%9747e1a6f9fd7ecd
                )

        )

)

Test

It has routes, so you can go to /matriphe/gcmon your URL and try to send the GCM notification., (*12)

The Versions

24/06 2015

dev-master

9999999-dev

Simple GCM push using Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle notification push gcm android

24/06 2015

1.3

1.3.0.0

Simple GCM push using Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle notification push gcm android

24/06 2015

1.2

1.2.0.0

Simple GCM push using Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle notification push gcm android

12/06 2015

1.1

1.1.0.0

Simple GCM push using Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle notification push gcm android

11/06 2015

1.0

1.0.0.0

Simple GCM push using Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel guzzle notification push gcm android