A PHP library for sending Firebase Cloud Messages and managing user topic subscriptions, device groups and devices.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
src
tests
.coveralls.yml
.travis.yml
LICENSE.md
README.md
composer.json
composer.lock
phpunit.dist.xml

README.md

PHP-FCM Build Status Coverage Status Documentation

A PHP library for sending Firebase Cloud Messages and managing user topic subscriptions, device groups and devices.

Installation

Installation with composer:

composer require edwinhoksberg/php-fcm

Quickstart

// Instantiate the client with the project api_token and sender_id.
$client = new \Fcm\FcmClient($apiToken, $senderId);

// Instantiate the push notification request object.
$notification = new \Fcm\Push\Notification();

// Enhance the notification object with our custom options.
$notification
    ->addRecipient($deviceId)
    ->setTitle('Hello from php-fcm!')
    ->setBody('Notification body')
    ->addData('key', 'value');

// Send the notification to the Firebase servers for further handling.
$client->send($notification);

Full documentation

Read the documentation here or look in the docs directory.

Tests

Run the unit tests with PHPUnit:

vendor/bin/phpunit -c phpunit.dist.xml

License

MIT