Download the PHP package devkandil/notifire without Composer

On this page you can find all versions of the php package devkandil/notifire. 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 notifire

Laravel FCM Notifier 🔥📬

Send push notifications with style, grace, and a tiny bit of panic.

A Laravel package for sending Firebase Cloud Messaging (FCM) notifications with support for Laravel's notification system.

Why?

Because your app deserves to annoy users in real-time — respectfully, of course.

Features

Coming Soon

Installation

You can install the package via composer:

Configuration

  1. Publish the package files:

  2. Add your Firebase project ID to your .env file:

  3. Place your Firebase service account credentials JSON file in your Laravel storage directory:

Important: Make sure to add this file to your .gitignore to keep your credentials secure.

If you need to use a different location for your credentials file, you can modify the credentials_path value in the published config file (config/fcm.php).

  1. Run the migrations:

  2. Add the fcm_token field to your User model's $fillable array:

This is required for the package to store FCM tokens in your user model.

Usage

Using the Facade

Direct Usage

Updating FCM Token

The package includes a built-in controller (FcmController) that handles FCM token updates. This controller is automatically loaded by the package and doesn't need to be published to your application.

You can use the provided API endpoint to update a user's FCM token:

Headers:

Request Body:

Response:

Note: The route is automatically registered with Sanctum authentication middleware. Make sure your user is authenticated with Sanctum before making this request.

Using the HasFcm Trait

Add the HasFcm trait to your model to easily manage FCM tokens and send notifications:

This trait provides the following methods:

Using Laravel Notifications

The package includes an example notification that demonstrates all available features:

To create your own notification:

  1. Create a notification:

  2. Implement the toFcm method:

  3. Add the FCM channel to your notification:

  4. Add the HasFcm trait to your Notifiable model (this automatically adds the routeNotificationForFcm method):

  5. Send the notification:

Raw FCM Messages

For complete control over the FCM message payload, you can use the fromRaw method. This method allows you to send a custom FCM message with your own payload structure:

This method is useful when you need to customize the FCM message beyond what the fluent interface provides, or when you're migrating from an existing FCM implementation.

Available Notification Options

The NotiFire package provides several options to customize your notifications:

Option Method Description
Title withTitle() Sets the notification title
Body withBody() Sets the notification body text
Image withImage() Sets an image URL to display in the notification
Icon withIcon() Sets an icon to display with the notification
Color withColor() Sets the color for the notification (in hexadecimal format, e.g., #FF5733)
Sound withSound() Sets the sound to play when the notification is received
Click Action withClickAction() Sets the action to perform when notification is clicked
Priority withPriority() Sets the notification priority level
Additional Data withAdditionalData() Sets additional data to send with the notification

When using the HasFcm trait, you can pass these options as an array:

Logging

All notification attempts are automatically logged. You can find the logs in your Laravel log files with the following contexts:

Testing

To run the tests, you need to have a valid Firebase configuration:

  1. Set up your Firebase project and obtain the credentials JSON file
  2. Configure your .env file with the required Firebase variable:

  3. Place your Firebase service account credentials JSON file in your Laravel storage directory:

  4. Optionally, you can set a custom FCM test token in your .env file:

This is particularly useful when running tests in applications that use this package, as you won't be able to modify the test files in the vendor directory.

  1. When writing tests, make sure to use properly formatted FCM tokens. Firebase Cloud Messaging tokens follow a specific format:

The token typically consists of:

Using invalid token formats (like test-token) will cause tests to fail when run against the actual Firebase service.

Then run the tests:

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of notifire with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0|^11.0|^12.0
google/apiclient Version ^2.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 devkandil/notifire contains the following files

Loading the files please wait ....