PHPackages                             meddev/laravel-push-notification - 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. meddev/laravel-push-notification

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

meddev/laravel-push-notification
================================

Laravel package to send push notification across all platforms (apns, fcm)

1.0.0.x-dev(9y ago)2129[2 issues](https://github.com/hamidmedgjonaj/LaravelPushNotification/issues)MITPHP

Since Sep 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/hamidmedgjonaj/LaravelPushNotification)[ Packagist](https://packagist.org/packages/meddev/laravel-push-notification)[ RSS](/packages/meddev-laravel-push-notification/feed)WikiDiscussions 1.0.0 Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

\#Install Add follow line into "require" section in your composer.json:

```
"meddev/laravel-push-notification": "1.0.0.x-dev"
```

Update composer with command:

```
"composer update"
```

\###Provider and Facade Like all providers, put this follow lines in your config/app.php

```
'providers' => [
	...
	MedDev\PushNotification\PushNotificationProvider::class,
],
```

```
'aliases' => [
	...
	'PushNotificationFacade' => MedDev\PushNotification\Facades\PushNotificationFacade::class,
],
```

\###Configuration Finally you need to generate a configuration file for this package. Run follow composer command:

```
php artisan vendor:publish --provider="MedDev\PushNotification\PushNotificationProvider"
```

This command will generate `pushnotification.php` file in your config directory.

```
return [

    "aps" => [
        	/*
        	 * A valid PEM certificate generated from Apple Push Service certificate
        	 */
            "certificate" 	=> storage_path('app')."/aps.pem",

        	/*
        	 * Password used to generate a certificate
        	 */
            "passPhrase"  	=> "",

            /*
             * Server used to send push notifications
             */
            "server"  	=> "ssl://gateway.push.apple.com:2195",
            //"server"  	=> "https://api.development.push.apple.com",

            /*
        	 * Set to TRUE if HTTP/2 Is Enabled for Your SSL application
        	 */
            "useApi"    => false
        ],

        "fcm" => [
        	/*
        	 * Google FCM api server key
        	 * You can retrieve your key in Firebase Console
        	 */
            "apiKey"      	=> "",

            /*
        	 * Server used to send push notifications
        	 */
            "server"  	=> "https://fcm.googleapis.com/fcm/send"
        ]

];
```

Remember to add your FCM api key and PEM certificate path.

\#Tokens You should have a model to store devices information into your database. To fit your model to be used directly from PushNotification Package you simply need to add `use DeviceTrait`:

```
use MedDev\PushNotification\DeviceTrait;

class YourDevicesTable extends Model
{
    use DeviceTrait;
}
```

To works automatically with PushNotification Package your table needs two columns, one that contains platform name, and the other one that contains device token.

By default this two columns names are considered `"platform"` and `"device_token"`

```
+--------------+
| Field        |
+--------------+
| id           |
| platform     | enum (android, ios, web)
| device_token |
| created_at   |
| updated_at   |
+--------------+

```

You can design your table as you want, only this two fields are mandatory to work with PushNotification Package.

\#Payload You just create a class that implements `MedDev\PushNotification\Contracts\Payload` and overwrite `apsPayload` and `fcmPayload` properties with your payload content.

```
namespace App\Payload;

use App\User;
use MedDev\PushNotification\Contracts\Payload;

class MessagePayload extends Payload
{
	/**
	 * Generate Notification Payload
	 *
	 * @param User $user
	 * @return void
	 */
	public function __construct(User user)
	{
		//IOS payload format
		$this->apsPayload = [
				"alert" => [
					"title" => "Someone has sent you a message",
                    "body" 	=> "This is the notification body text",
				],
		];

		//Android notification types can be 'notification' and 'data'
		$this->fcmPayloadType = "notification";

		//Android payload format
		$this->fcmPayload = [
				"title" => "Someone has sent you a message",
				"body" 	=> "This is the notification body text",
		];
	}
}
```

You can proceed to create your payload collection for every event or message that you want send to your users.

\#Send Now you are able to get a list of devices tokens from your DB and you have a payload for your specific event. To send a payload to a list of devices you can use `send` method inherited from Payload class.

\###Regular send

```
//Create payload
$payload = new MessagePayload(User::findOrFail(1));

//Retrieve devices list with your own criteria
$tokens = YourDevicesTable::all();

//send directly
$payload->send($tokens);
```

\###Send by Queue Package use Queue to send notification natively to execute your send task in background. You need to set your Queue provider in config/queue.php and your payload will be sent on queue.

With second param of "send" method you can schedule job in a specific queue.

```
//push in queue
$payload->send($payload, $tokens, "your-queue-name");
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

3541d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6725503?v=4)[meddev](/maintainers/meddev)[@meddev](https://github.com/meddev)

---

Top Contributors

[![hamidzetta](https://avatars.githubusercontent.com/u/25983990?v=4)](https://github.com/hamidzetta "hamidzetta (21 commits)")

---

Tags

laravelpushnotificationFCMapns

### Embed Badge

![Health badge](/badges/meddev-laravel-push-notification/health.svg)

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

###  Alternatives

[mcfedr/awspushbundle

A set of services to simplify using Aws to send push notifications

40382.7k1](/packages/mcfedr-awspushbundle)

PHPackages © 2026

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