Download the PHP package swanflutter/notification-master without Composer
On this page you can find all versions of the php package swanflutter/notification-master. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download swanflutter/notification-master
More information about swanflutter/notification-master
Files in swanflutter/notification-master
Package notification-master
Short Description A modern PHP 8.2+ / Laravel push notification package supporting Firebase FCM HTTP v1 and polling mode.
License MIT
Homepage https://github.com/swanflutter/notification-master
Informations about the package notification-master
swanflutter/notification-master
A modern, production-ready PHP 8.2+ / Laravel push notification package built on the Firebase Cloud Messaging (FCM) HTTP v1 API.
Supports real-time FCM delivery and a polling-mode fallback — all with a clean fluent API, typed exceptions, and first-class Laravel integration.
Table of Contents
- Requirements
- Installation
- Laravel Setup
- Standalone PHP Setup
- Configuration
- Usage — FCM Push
- Send to a Device Token
- Send to a Topic
- Send to a Condition
- Multicast (Multiple Tokens)
- Advanced Message Builder
- Raw Payload
- Dry-Run Mode
- Retry Configuration
- Usage — Laravel Notification Channel
- Usage — Laravel Facade
- Usage — Polling Mode
- How Polling Works
- Enqueue a Notification
- Client Polling Endpoint
- Flush & Forward via FCM
- Custom Poll Store
- Exception Handling
- Testing
- Changelog
- License
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
guzzlehttp/guzzle |
^7.9 |
swanflutter/native-jwt |
^1.2 |
| Laravel (optional) | ^10.0 \| ^11.0 \| ^12.0 |
Note: This package uses
swanflutter/native-jwtfor JWT signing (RS256). It is a drop-in, dependency-free replacement forfirebase/php-jwtwith built-inalg=noneand algorithm-confusion protection. The oldfirebase/php-jwtdependency has been removed.
Installation
Install the package via Composer:
To install a specific version:
Resolving a JWT library conflict
This package depends on swanflutter/native-jwt
for RS256 JWT signing. If your application still requires the deprecated
firebase/php-jwt, you can migrate to swanflutter/native-jwt, which is a
drop-in replacement exposing the same JWT::encode() / JWT::decode() API:
If your application or another dependency still pins firebase/php-jwt, run
composer why firebase/php-jwt to find which package holds it back.
Laravel Setup
The package is auto-discovered. After installing, publish the config file:
This creates config/push-notification.php in your application.
Set the path to your Firebase service-account JSON file in .env:
The service-account JSON is generated in the Firebase Console under Project Settings → Service Accounts → Generate New Private Key.
Standalone PHP Setup
No framework integration required — just instantiate FirebasePush directly:
Configuration
config/push-notification.php (after publishing):
Usage — FCM Push
Send to a Device Token
Send to a Topic
Send to a Condition
Multicast (Multiple Tokens)
Advanced Message Builder
Raw Payload
Send any FCM-compatible payload directly, bypassing the builder:
Dry-Run Mode
Retry Configuration
Usage — Laravel Notification Channel
Add toFcm() to your Laravel notification class:
Your notifiable model must implement routeNotificationForFcm() if no target is set on the Message:
Then send it like any other Laravel notification:
Usage — Laravel Facade
Usage — Polling Mode
Polling mode stores notifications server-side so that client devices can retrieve them on demand via a regular HTTP call. No native push infrastructure required.
How Polling Works
Enqueue a Notification
Schedule delivery for a future time:
Client Polling Endpoint
Flush & Forward via FCM
Deliver all queued notifications immediately via FCM and mark them delivered:
Custom Poll Store
Implement PollStoreInterface to use your own storage backend (Eloquent, Redis, SQS, …):
Bind it in your AppServiceProvider:
Exception Handling
All exceptions extend SwanFlutter\NotificationMaster\Exceptions\PushNotificationException.
| Exception | When thrown |
|---|---|
InvalidCredentialsException |
Service-account file missing, unreadable, or malformed |
AuthenticationException |
JWT signing or Google OAuth token fetch failed |
InvalidMessageException |
Message missing a target or content |
SendingFailedException |
FCM HTTP request failed (network / FCM error); includes getFcmResponse() |
Testing
For unit tests, use ArrayPollStore as a lightweight in-memory poll store:
Changelog
See CHANGELOG.md for a full history of changes.
License
This package is open-source software licensed under the MIT License.
All versions of notification-master with dependencies
ext-json Version *
ext-openssl Version *
guzzlehttp/guzzle Version ^7.9
swanflutter/native-jwt Version ^1.2