PHPackages                             laravel-notification-channels/gcm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. laravel-notification-channels/gcm

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

laravel-notification-channels/gcm
=================================

Android GCM Push Notification Channel

v0.4.0(7y ago)54215.9k↓33.7%21MITPHPPHP &gt;=7.0.0

Since Aug 27Pushed 6y ago3 watchersCompare

[ Source](https://github.com/laravel-notification-channels/gcm)[ Packagist](https://packagist.org/packages/laravel-notification-channels/gcm)[ Docs](https://github.com/laravel-notification-channels/gcm)[ RSS](/packages/laravel-notification-channels-gcm/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (7)Versions (9)Used By (0)

Laravel GCM (Google Cloud Messaging) Notification Channel
=========================================================

[](#laravel-gcm-google-cloud-messaging-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/241be38daedd6f3aa3240856751142a1433bd70cb04071a8ea7267745fa55365/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f67636d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/gcm)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/bf112188679db0328fdb3eebfc59e73f7c497aac68b6276793823ca82a163771/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f67636d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/laravel-notification-channels/gcm)[![StyleCI](https://camo.githubusercontent.com/67637887d7eb5e778088041abcd0d6401f0a4b14ad2ac5b8b77d5511df13c36f/68747470733a2f2f7374796c6563692e696f2f7265706f732f36363434393435372f736869656c64)](https://styleci.io/repos/66449457)[![SensioLabsInsight](https://camo.githubusercontent.com/fa17d00b1bbe12475071d080accd8da12a536e4a5e443dbad54898f6170bf8bd/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f35366534623863322d336361352d346433302d393234612d6362653631333166616162632e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/56e4b8c2-3ca5-4d30-924a-cbe6131faabc)[![Quality Score](https://camo.githubusercontent.com/655b62e1e1a5776a112402c22fdbd132bc4b5683102d871b630426ae63be931c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f67636d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/gcm)[![Code Coverage](https://camo.githubusercontent.com/f050e5b4d872283c9474bed7797103e881c61fec30d0228150f7836836c08abf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f67636d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/gcm/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/c24720c8758ea7664299ef2ed77c0161232290446a7c61c882a803ffd53a62b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f67636d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/gcm)

This package makes it easy to send notifications using Google Cloud Messaging (GCM) with Laravel 5.8.

This package is based on [ZendService\\Google\\Gcm](https://framework.zend.com/manual/2.4/en/modules/zendservice.google.gcm.html), so please read that documentation for more information.

**Google has deprecated/discontinued GCM as of April 11, 2019. As such, this package is also considered deprecated.**

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up the GCM service](#setting-up-the-gcm-service)
- [Usage](#usage)
    - [Available Message methods](#available-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Installation
------------

[](#installation)

Install this package with Composer:

```
composer require laravel-notification-channels/gcm

```

Register the ServiceProvider in your config/app.php:

```
NotificationChannels\Gcm\GcmServiceProvider::class,

```

### Setting up the GCM service

[](#setting-up-the-gcm-service)

You need to register for a server key for Google Cloud Messaging for your App in the Google API Console:

Add the API key to your configuration in config/broadcasting.php

```
'connections' => [
  ....
  'gcm' => [
      'key' => env('GCM_KEY'),
  ],
  ...
]

```

Usage
-----

[](#usage)

You can now send messages to GCM by creating a GcmMessage:

```
use NotificationChannels\Gcm\GcmChannel;
use NotificationChannels\Gcm\GcmMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [GcmChannel::class];
    }

    public function toGcm($notifiable)
    {
        return GcmMessage::create()
            ->title('Account approved')
            ->message("Your {$notifiable->service} account was approved!");
    }
}
```

In your `notifiable` model, make sure to include a `routeNotificationForGcm()` method, which return one or an array of tokens.

```
public function routeNotificationForGcm()
{
    return $this->gcm_token;
}
```

### Available methods

[](#available-methods)

- title($str)
- message($str)
- priority(`GcmMessage::PRIORITY_NORMAL` or `GcmMessage::PRIORITY_HIGH`)
- data($key, $mixed)
- notification($key, $mixed)
- action($action, $params) (Will set an `action` data key)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Fruitcake](https://github.com/fruitcake)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~153 days

Recently: every ~142 days

Total

7

Last Release

2681d ago

PHP version history (2 changes)0.0.1PHP &gt;=5.5

v0.2.1PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/dad47b02be23edb7094a151b4b1ce7e9cb56b75cd87cd3341d140e1e1e9cd0e4?d=identicon)[barryvdh](/maintainers/barryvdh)

![](https://avatars.githubusercontent.com/u/20937037?v=4)[Laravel Notification Channels](/maintainers/laravel-notification-channels)[@laravel-notification-channels](https://github.com/laravel-notification-channels)

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (16 commits)")[![TechGuard](https://avatars.githubusercontent.com/u/677174?v=4)](https://github.com/TechGuard "TechGuard (9 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (9 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (5 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (2 commits)")[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (2 commits)")[![az-iar](https://avatars.githubusercontent.com/u/1249596?v=4)](https://github.com/az-iar "az-iar (2 commits)")[![vrajroham](https://avatars.githubusercontent.com/u/12662173?v=4)](https://github.com/vrajroham "vrajroham (1 commits)")[![joelennon](https://avatars.githubusercontent.com/u/167845?v=4)](https://github.com/joelennon "joelennon (1 commits)")[![LonnyX](https://avatars.githubusercontent.com/u/10662320?v=4)](https://github.com/LonnyX "LonnyX (1 commits)")[![mo7amed-3bdalla7](https://avatars.githubusercontent.com/u/11799413?v=4)](https://github.com/mo7amed-3bdalla7 "mo7amed-3bdalla7 (1 commits)")[![themsaid](https://avatars.githubusercontent.com/u/4332182?v=4)](https://github.com/themsaid "themsaid (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-notification-channels-gcm/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-notification-channels-gcm/health.svg)](https://phpackages.com/packages/laravel-notification-channels-gcm)
```

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2022.2M8](/packages/laravel-notification-channels-apn)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2588.4M17](/packages/laravel-notification-channels-twilio)[illuminate/notifications

The Illuminate Notifications package.

513.1M1.1k](/packages/illuminate-notifications)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
