Download the PHP package redjanym/php-firebase-cloud-messaging without Composer
On this page you can find all versions of the php package redjanym/php-firebase-cloud-messaging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redjanym/php-firebase-cloud-messaging
More information about redjanym/php-firebase-cloud-messaging
Files in redjanym/php-firebase-cloud-messaging
Package php-firebase-cloud-messaging
Short Description PHP SDK for Firebase Cloud Messaging from Google
License MIT
Homepage https://github.com/redjanym/php-firebase-cloud-messaging
Informations about the package php-firebase-cloud-messaging
PHP Firebase Cloud Messaging
PHP SDK for Firebase Cloud Messaging from Google, supporting the HTTP V1 API.
See the official Firebase docs: https://firebase.google.com/docs/cloud-messaging
Requirements
- PHP >= 7.4
- A Firebase service account JSON file (how to generate one)
Setup
Install via Composer:
Or add this to your composer.json and run composer update:
Usage
Send a Message to a Device
Send a Message to a Topic
Clients subscribe to topics from the client app. See the Firebase topic documentation for details on managing topic subscriptions.
Customizing Notifications
The Notification object exposes public properties for platform-specific configuration:
Testing
Install dev dependencies and run the test suite with PHPUnit:
To run a specific test file:
To run a specific test method:
Migrating from V1
V2 of this package introduces breaking changes due to the migration from the legacy FCM API to the HTTP V1 API. The new structure is still simple and very similar to the previous one.
Interpreting Responses
The send() method returns a PSR-7 ResponseInterface. Responses follow the standard FCM specifications: