PHPackages                             weelis/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. weelis/notification

ActiveWeelis-modules[Mail &amp; Notifications](/categories/mail)

weelis/notification
===================

Weelis Notification Channel (APN, FCM, SMS, EMAIL)

v1.0.3(3y ago)016PHP

Since Apr 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hocnt84/weelis-notification)[ Packagist](https://packagist.org/packages/weelis/notification)[ RSS](/packages/weelis-notification/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

laravel-weelis-notification
===========================

[](#laravel-weelis-notification)

Weelis Notification Channel (APN, FCM, ESMS)

Use this package to send push notifications via Laravel to Firebase Cloud Messaging, APN, ESMS. Laravel 5.3+ required.

Install
-------

[](#install)

This package can be installed through Composer.

```
composer require weelis/notification
```

Once installed, add the service provider:

```
// config/app.php
'providers' => [
    ...
    Weelis\Notification\NotificationServiceProvider::class,
    ...
];
'aliases' => [
    ...
    'NotificationHelper'=> \Weelis\Notification\Facade\NotificationHelper::class
    ...
]
```

Publish the config file:

```
php artisan vendor:publish --provider="Weelis\Notification\NotificationServiceProvider"
```

### Register device

[](#register-device)

Using existing controller add this to your route

```
Route::group(['prefix' => 'device'], function () {
    Route::post('register', '\Weelis\Notification\Controller\DevicesController@registerDevice');
    Route::post('unregister', '\Weelis\Notification\Controller\DevicesController@unregisterDevice');
});
```

### Using notification database model &amp; report

[](#using-notification-database-model--report)

```
use Weelis\Notification\Base\Notifiable;
use Weelis\Notification\Model\NotificationModel;

class User extends Authenticatable
{
    use Notifiable, NotificationModel;
    ...
}
```

Using facade

```
$request => ['os'         => 'required',
//          'device'       => 'required',
			'type'       => 'required',
			'did'        => 'required',
			'scope'      => 'required',
//			'push_token' => 'required']
NotificationHelper::registerDevice($request);
```

### Setting up the FCM service

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

The following config file will be published in `config/notification.php`. Add your Firebase API Key here.

Set up .env file

```
FCM_API_KEY=legacy key
```

OR

```
return [
    /*
     * Add the Firebase API key
     */
    'fcm' => [
        'api_key' => ''
    ],
];
```

#### Example Usage

[](#example-usage)

Use Artisan to create a notification:

```
php artisan make:notification SomeNotification
```

Return `[fcm]` in the `public function via($notifiable)` method of your notification:

```
public function via($notifiable)
{
    return ['fcm'];
}
```

Add the method `public function toFcm($notifiable)` to your notification, and return an instance of `FcmMessage`:

```
public function toFcm($notifiable)
{
    $message = new Weelis\Notification\Fcm\FcmMessage();
    $message->content([
        'title'        => 'Foo',
        'body'         => 'Bar',
        'sound'        => '', // Optional
        'icon'         => '', // Optional
        'click_action' => '' // Optional
    ])->data([
        'param1' => 'baz' // Optional
    ])->priority(Weelis\Notification\Fcm\FcmMessage::PRIORITY_HIGH); // Optional - Default is 'normal'.

    return $message;
}
```

When sending to specific device, make sure your notifiable entity has `routeNotificationForFcm` method defined:

```
/**
 * Route notifications for the FCM channel.
 *
 * @return string
 */
public function routeNotificationForFcm()
{
    return $this->device_token;
}
```

When sending to a topic, you may define so within the `toFcm` method in the notification:

```
public function toFcm($notifiable)
{
    $message = new Weelis\Notification\Fcm\FcmMessage();
    $message->to('the-topic', $recipientIsTopic = true)
    ->content([...])
    ->data([...]);

    return $message;
}
```

### Setting up the APN service

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

Before using the APN Service, follow the [Provisioning and Development guide from Apple](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ProvisioningDevelopment.html)

You will need to generate a certificate for you application, before you can use this channel. Configure the path in config/broadcasting.php

Set up .env file

```
APN_KEY_DEV={"user":{"cert":"/storage/path/file","pass":"passphrase"},"worker":{"cert":"/storage/path/file","pass":"passphrase"}}
APN_KEY_PRO={"user":{"cert":"/storage/path/file","pass":"passphrase"},"worker":{"cert":"/storage/path/file","pass":"passphrase"}}
```

#### Usage

[](#usage)

You can now send messages to APN by creating a ApnMessage:

Return `[apn]` in the `public function via($notifiable)` method of your notification:

```
use Weelis\Notification\Apn\ApnMessage;
use Illuminate\Notifications\Notification;

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

    public function toApn($notifiable)
    {
        return ApnMessage::create()
            ->badge(1)
            ->title('Account approved')
            ->body("Your {$notifiable->service} account was approved!");
    }
}
```

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

```
public function routeNotificationForApn()
{
    return $this->apn_token;
}
```

### Setting up the ESMS service

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

Set up .env file

```
ESMS_API_KEY=
ESMS_SECRET_KEY=
ESMS_SMS_TYPE=6
ESMS_BRAND_NAME=
ESMS_URL=http://rest.esms.vn/MainService.svc/json/SendMultipleMessage_V4_get
ESMS_DAY_MAX=5
```

#### Usage

[](#usage-1)

You can now send messages to Esms:

Return `[esms]` in the `public function via($notifiable)` method of your notification:

```
use Illuminate\Notifications\Notification;

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

    public function toApn($notifiable)
    {
        return [
            "sms" =>
        ];
    }
}
```

When sending to specific device, make sure your notifiable entity has `routeNotificationForEsms` method defined:

```
/**
 * Route notifications for the FCM channel.
 *
 * @return string
 */
public function routeNotificationForEsms()
{
    return $this->phone;
}
```

### Sending user channel

[](#sending-user-channel)

```
use Weelis\Notification\Base\NotificationToUser;

$user->notify(new NotificationToUser([
    'scope' => "user",
    'types' => ['email', 'esms', 'apn', 'fcm'],
    'title' => "Foo",
    'body' => "Bar",
    'icon' => "", // Optional
    'sound' => "", // Optional
    'type' => "Foo Bar",
    'type_slug' => "foo-bar",
    'email_view' => 'foo.bar', // Optional
    'custom' => [ // use for email view param also
        'foo' => '',
        'bar' => '',
        'click_action' => ""
    ] // Optional
]), $notifitable_model  // Optional);
```

License
-------

[](#license)

This project belong to vias company.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~0 days

Total

4

Last Release

1130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94f1e0a471bac0f257bc54c613a846bb2563983d001fc901a5a17c27e6db4047?d=identicon)[hocnt84](/maintainers/hocnt84)

---

Top Contributors

[![hocnt84](https://avatars.githubusercontent.com/u/13724833?v=4)](https://github.com/hocnt84 "hocnt84 (3 commits)")

### Embed Badge

![Health badge](/badges/weelis-notification/health.svg)

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

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)

PHPackages © 2026

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