Download the PHP package cofa/notification_via_firebase_and_database without Composer

On this page you can find all versions of the php package cofa/notification_via_firebase_and_database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package notification_via_firebase_and_database

Firebase & Database Notifications for Laravel

CI Latest Version on Packagist Total Downloads License: MIT PHP Version

A Laravel package for sending push notifications via Firebase Cloud Messaging (FCM) and storing them in the database — using Laravel's native notification pipeline with a clean, channel-based architecture.


Features


Requirements

Requirement Version
PHP ^8.2
Laravel ^10.0 \| ^11.0 \| ^12.0
kreait/firebase-php ^7.0 \| ^8.0

Installation

Install via Composer:

Register the Service Provider

Laravel 11+ — auto-discovered, no action needed.

Laravel 10 — add to config/app.php:


Configuration

1. Publish the Config File

This creates config/firebase-notification.php:

2. Add Your Firebase Credentials

  1. Go to Firebase Console → Project Settings → Service Accounts
  2. Click Generate new private key and download the JSON file
  3. Place it in your project (recommended: storage/app/firebase/credentials.json)
  4. Add the path to .gitignore — never commit credentials to version control

3. Set Up the Database

This creates two tables:

user_device_tokens Schema

Column Type Description
user_id foreignId References users.id
device_token string Unique FCM device token
device_type enum android, ios, web
device_name string (nullable) Optional device label
is_active boolean Whether token is active
last_used_at timestamp (nullable) Last delivery timestamp

Usage

1. Prepare Your User Model

Add the Notifiable trait and implement routeNotificationForFirebase:


2. Firebase + Database Notification (Combined)

Extend FirebaseNotification to send both push and database notifications at once:

Send it:


3. Firebase-Only Notification


4. Database-Only Notification


5. Reading Notifications


Advanced Usage

Platform-Specific Payload Configuration


Error Handling

Always wrap notifications in a try/catch for production use:

Common failure reasons:

Tip: When an FCM token returns a NOT_REGISTERED error from Firebase, delete it from user_device_tokens to keep your token table clean.


Extending the Package

You can implement the Notification interface to create fully custom channels:


Architecture


Testing


Security


Contributing

Contributions, issues, and feature requests are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'feat: add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

Please make sure your PR includes tests and passes composer test and composer psalm.


Changelog

v2.0.0

v1.1.2

v1.1.1

v1.1.0

v1.0.x


License

This package is open-source software licensed under the MIT license.


Credits

Author: Mahmoud Gamal Email: [email protected] GitHub: github.com/Cofa12


Support

For bugs, questions, or feature requests, please open an issue on GitHub.


All versions of notification_via_firebase_and_database with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
kreait/firebase-php Version ^7.0|^8.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/config Version ^10.0|^11.0|^12.0|^13.0
illuminate/notifications Version ^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cofa/notification_via_firebase_and_database contains the following files

Loading the files please wait ...