PHPackages                             usmian/php-fcm-v1-php-8 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. usmian/php-fcm-v1-php-8

ActiveLibrary

usmian/php-fcm-v1-php-8
=======================

PHP Implementation of FCM HTTP v1 API. Fork from lkaybob/php-fcm-v1 and change Firebase JWT, Guzzle version

v1.1.2(1y ago)1569↓50%MITPHPPHP &gt;=7.1

Since Jul 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/usmian/php-fcm-push)[ Packagist](https://packagist.org/packages/usmian/php-fcm-v1-php-8)[ Docs](https://github.com/lkaybob/phpFCMv1)[ RSS](/packages/usmian-php-fcm-v1-php-8/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

php-fcm-v1
==========

[](#php-fcm-v1)

[![Build Status](https://github.com/lkaybob/php-fcm-v1/actions/workflows/main.yml/badge.svg)](https://github.com/lkaybob/php-fcm-v1/actions)[![codecov](https://camo.githubusercontent.com/3fff14de601c89fc2d226d4b45c035de15316ff7cf6720c8776ff2824fc2100e/68747470733a2f2f636f6465636f762e696f2f67682f6c6b6179626f622f7068702d66636d2d76312f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/lkaybob/php-fcm-v1)[![Latest Stable Version](https://camo.githubusercontent.com/6f3e91f6918d97f74002a5b5c702dcf2ab2d1fad271bc9cd14a545ddf8333f95/68747470733a2f2f706f7365722e707567782e6f72672f6c6b6179626f622f7068702d66636d2d76312f762f737461626c65)](https://packagist.org/packages/lkaybob/php-fcm-v1)[![Total Downloads](https://camo.githubusercontent.com/a14b21378813fee3660eec17d7923ec309d906d6572799c1d0746e6decb40d39/68747470733a2f2f706f7365722e707567782e6f72672f6c6b6179626f622f7068702d66636d2d76312f646f776e6c6f616473)](https://packagist.org/packages/lkaybob/php-fcm-v1)[![License](https://camo.githubusercontent.com/5dcdcc102a8a32f2ca95da029dc75db60c4ee03cfc7b01c10d2d1c9567c39253/68747470733a2f2f706f7365722e707567782e6f72672f6c6b6179626f622f7068702d66636d2d76312f6c6963656e7365)](https://packagist.org/packages/lkaybob/php-fcm-v1)

php-fcm-v1 is an PHP implementation of [FCM](https://firebase.google.com/docs/cloud-messaging) HTTP v1 API

### What is different compared to others FCM Libraries?

[](#what-is-different-compared-to-others-fcm-libraries)

Most of other libraries are implementation of FCM's [Legacy HTTP Server Protocol](https://firebase.google.com/docs/cloud-messaging/http-server-ref). It requires a server key from Firebase console (which means you have to copy and paste in your code) ([Docs](https://firebase.google.com/docs/cloud-messaging/auth-server#authorize_legacy_protocol_send_requests))

HTTP v1 API, in contrast, leverages OAuth2 security model. You need to get an access token (which is valid for about an hour) in order to request sending notification with service account's private key file. Although (See the blog [post](https://firebase.googleblog.com/2017/11/whats-new-with-fcm-customizing-messages.html) about HTTP v1 API)

### References

[](#references)

- [google/node-gtoken](https://github.com/google/node-gtoken)
- [google/google-auth-library-nodejs](https://github.com/google/google-auth-library-nodejs): Above two libraries let me understand how HTTP v1 API works in FCM
- [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) : GuzzleHttp let this library to PSR7 compatible
- [Paragraph1/php-fcm](https://github.com/Paragraph1/php-fcm) : Inspired me how FCM libraries are used in Legacy HTTP Protocol

### How to use

[](#how-to-use)

- Install the library with composer

    ```
    composer require trantuanson1991/php-fcm-v1

    ```

---

- Import the library with *autoload.php*

    ```
