Download the PHP package williamcruzme/laravel-fcm without Composer

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

Laravel FCM

Laravel GitHub


laravel-fcm is a powerful Laravel package to send Push Notifications to all devices of one or many users. Being channel-based you only need to specify the channel in your Laravel Notification.

Features

📄 Content

💿 Installation

1. Configure the enviroment

Get the Service Account and paste in your .env file:
(gear-next-to-project-name) > Project Settings > Cloud Messaging

2. Adding traits

In your App\Models\User model add the HasDevices trait:

Remember, you are not limited to only including the trait on your App\Models\User model.

3. Running migrations

(Optional) Sometimes you may need to customize the migrations. Using the vendor:publish command you can export the migrations:

4. Adding routes

In your routes/api.php add the routes using the Device facade, this is for manage the devices:

⚡ Create notification

1. Creating notifications

2. Adding delivery channels

Every notification class has a via method that determines on which channels the notification will be delivered. Add fcm as delivery channel:

3. Formatting notifications

The notification method support the Firebase payload:

4. Sending notifications

FcmMessage automatically gets all devices of the notifiable entities; you just need to send notifications. Notifications may be sent in two ways: using the notify method of the Notifiable trait or using the Notification facade. First, let's explore using the trait:

Using The Notifiable Trait

This trait is utilized by the default App\User model and contains one method that may be used to send notifications: notify. The notify method expects to receive a notification instance:

Remember, you may use the Illuminate\Notifications\Notifiable trait on any of your models. You are not limited to only including it on your App\User model.

Using The Notification Facade

Alternatively, you may send notifications via the Notification facade. This is useful primarily when you need to send a notification to multiple notifiable entities such as a collection of users. To send notifications using the facade, pass all of the notifiable entities and the notification instance to the send method:

🌐 Routes

These routes are generated automatically, once wherever you add Device::routes();

Add device

Method URI
POST /devices

Body Params

Remove device

Method URI
DELETE /devices

Body Params

🎨 Customizing The Notification

Sending data

Using the data method you can specify the custom key-value pairs of the notification payload:

Adding conditions

Using the condition method you can specify a boolean expression to send the notification:

Setting priority

Using the priority method you can specify a priority of the notification. Default is normal:

Custom payload

Using the payload method you can specify a custom payload to the notification:

🎨 Customizing The Controller

First of all, create your own DeviceController controller and add the ManageDevices trait.

Second, modify the namespace of the Device facade routes to :

Custom request validations

The createRules deleteRules validationErrorMessages methods in the DeviceController allows you override the default request validations:

Custom response

The sendResponse and sendDestroyResponse method in the DeviceController allows you override the default response:

Custom guards

The guard method in the DeviceController allows you override the default guard:

🚸 Contributing

You are welcome to contribute to this project, but before you do, please make sure you read the contribution guide.

🔒 License

MIT


All versions of laravel-fcm with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|^8.0
guzzlehttp/guzzle Version *
illuminate/notifications Version *
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 williamcruzme/laravel-fcm contains the following files

Loading the files please wait ....