PHPackages                             appy/fcmhttpv1 - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. appy/fcmhttpv1

ActiveLibrary[HTTP &amp; Networking](/categories/http)

appy/fcmhttpv1
==============

FCM HTTP V1 packages

2920.0k↓18.4%12[6 issues](https://github.com/agence-appy/fcmhttpv1/issues)PHP

Since Sep 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/agence-appy/fcmhttpv1)[ Packagist](https://packagist.org/packages/appy/fcmhttpv1)[ RSS](/packages/appy-fcmhttpv1/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel FCM Http V1 API Package
===============================

[](#laravel-fcm-http-v1-api-package)

A [Laravel](https://laravel.com/) package that lets you use the new FCM Http V1 API and send push notifications with ease.

Summary
-------

[](#summary)

1. [Install](https://github.com/agence-appy/fcmhttpv1#install)
    - [Firebase](https://github.com/agence-appy/fcmhttpv1#firebase)
    - [Laravel](https://github.com/agence-appy/fcmhttpv1#laravel)
    - [Laravel PWA](https://github.com/agence-appy/fcmhttpv1#laravel-pwa)
2. [Usage](https://github.com/agence-appy/fcmhttpv1#usage)
    - [Topics](https://github.com/agence-appy/fcmhttpv1#firebase)
        - [Subscribe](https://github.com/agence-appy/fcmhttpv1#subscribe)
        - [Unsubscribe](https://github.com/agence-appy/fcmhttpv1#unsubscribe)
        - [List subscriptions](https://github.com/agence-appy/fcmhttpv1#list-subscriptions)
    - [Notification](https://github.com/agence-appy/fcmhttpv1#notification)
        - [Send to unique token](https://github.com/agence-appy/fcmhttpv1#send-to-unique-token)
        - [Send to topic](https://github.com/agence-appy/fcmhttpv1#send-to-topic)

Install
-------

[](#install)

If your firebase project is already setup, you can skip that part and go to the [Usage section](https://github.com/agence-appy/fcmhttpv1#usage) section.

The installation will take two steps. First we will build and manage the firebase project through the Firebase Console. Then we will see how you can implement the Firebase FCM Http V1 in your awesome Laravel project.

### Firebase

[](#firebase)

1. Go to the [Firebase console](https://console.firebase.google.com/u/0/).
2. Create a project
    [![Capture d’écran 2022-06-30 143010](https://user-images.githubusercontent.com/92929363/177950500-c2ab7f98-1593-461e-82c5-7d2065474e74.png)](https://user-images.githubusercontent.com/92929363/177950500-c2ab7f98-1593-461e-82c5-7d2065474e74.png)
3. Add a name
    [![Capture d’écran 2022-07-08 102739](https://user-images.githubusercontent.com/92929363/177950903-4b0ade29-2ce4-423f-980c-299444549030.png)](https://user-images.githubusercontent.com/92929363/177950903-4b0ade29-2ce4-423f-980c-299444549030.png)
4. Choose if you want to enable Analytics and create the project.
5. Add a Web App
    [![Capture d’écran 2022-07-08 103535](https://user-images.githubusercontent.com/92929363/177952387-b80d53e3-53f4-45b4-9050-e849b58e4e24.png)](https://user-images.githubusercontent.com/92929363/177952387-b80d53e3-53f4-45b4-9050-e849b58e4e24.png)
6. Add an app nickname
    [![Capture d’écran 2022-07-08 103625](https://user-images.githubusercontent.com/92929363/177952640-df8a5b86-7ce6-483e-9baf-a97751343378.png)](https://user-images.githubusercontent.com/92929363/177952640-df8a5b86-7ce6-483e-9baf-a97751343378.png)
7. Go into the project settings of the app, switch to the Service accounts tab then click on Generate new private key. It will download a json file containing credentials for your app.
8. Go to project settings, cloud messaging tab and enable CloudMessaging API ( click on the 3 dots on the right, Manage API in Google Cloud Console, and enable the API)
    [![Capture d’écran 2022-07-08 142946](https://user-images.githubusercontent.com/92929363/177992435-e29223f7-6189-4052-baa1-c0455b2cc092.png)](https://user-images.githubusercontent.com/92929363/177992435-e29223f7-6189-4052-baa1-c0455b2cc092.png)
9. Refresh firebase console page, a server key will be displayed under the Cloud Messaging API. (in Cloud Messaging tab)

Firebase configuration is now completed.

### Laravel

[](#laravel)

1. Put the downloaded json at the root of the project. (JSON downloaded at step 7 of Firebase configuration)
    [![Capture d’écran 2022-07-08 144029](https://user-images.githubusercontent.com/92929363/177993938-910ddac2-0472-45f3-9c30-3568e0e0244b.png)](https://user-images.githubusercontent.com/92929363/177993938-910ddac2-0472-45f3-9c30-3568e0e0244b.png)
2. Go to Firebase Console -&gt; Project Settings -&gt; General and watch firebaseConfig.
    [![Capture d’écran 2022-07-08 144454](https://user-images.githubusercontent.com/92929363/177994579-978d7fbc-5d23-4302-a66e-9d86edb8eb76.png)](https://user-images.githubusercontent.com/92929363/177994579-978d7fbc-5d23-4302-a66e-9d86edb8eb76.png)
3. Assign values to the .env variables

```
FCM_API_KEY=""
FCM_AUTH_DOMAIN=""
FCM_PROJECT_ID=""
FCM_STORAGE_BUCKET=""
FCM_MESSAGIN_SENDER_ID=""
FCM_APP_ID=""
FCM_JSON=""
FCM_API_SERVER_KEY=
```

4. Package installation

```
composer require appy/fcmhttpv1

```

5. Register the provider in config/app.php

```
Appy\FcmHttpV1\FcmProvider::class,
```

6. Publish config file

```
php artisan vendor:publish --tag=fcmhttpv1 --ansi --force

```

### Laravel PWA

[](#laravel-pwa)

1. Please follow this [tutorial](https://github.com/silviolleite/laravel-pwa) to configure Laravel PWA.
2. Create a file "firebase-messaging-sw.js" at public folder of your project.

```
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here. Other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js');

// Initialize the Firebase app in the service worker by passing in
// your app's Firebase config object.
// https://firebase.google.com/docs/web/setup#config-object
firebase.initializeApp({
  apiKey: 'api-key',
  authDomain: 'project-id.firebaseapp.com',
  databaseURL: 'https://project-id.firebaseio.com',
  projectId: 'project-id',
  storageBucket: 'project-id.appspot.com',
  messagingSenderId: 'sender-id',
  appId: 'app-id',
});

// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = firebase.messaging();
```

Usage
-----

[](#usage)

### Topics

[](#topics)

Topics are used to make groups of device tokens. They will allow you to send notification directly to the topic where users are registered in.

#### Subscribe

[](#subscribe)

To subscribe tokens to a topic :

```
use Appy\FcmHttpV1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::subscribeToTopic($tokens, "myTopic");
```

#### Unsubscribe

[](#unsubscribe)

```
use Appy\FcmHttpV1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::unsubscribeToTopic($tokens, "myTopic");
```

#### List subscriptions

[](#list-subscriptions)

```
use Appy\FcmHttpV1\FcmTopicHelper;

$token = "your awesome device token";
FcmTopicHelper::getTopicsByToken($token);
```

Notification
------------

[](#notification)

You can send notification to specific user or to topics.

### Send to unique token

[](#send-to-unique-token)

```
use Appy\FcmHttpV1\FcmNotification;

$notif = new FcmNotification();
$notif->setTitle("Title")->setBody("Message here")->setIcon("icon.png")->setToken("put device token here")->setClickAction("/news")->send();
```

### Send to topic

[](#send-to-topic)

```
use Appy\FcmHttpV1\FcmNotification;

$notif = new FcmNotification();
$notif->setTitle("Title")->setBody("Message here")->setIcon("icon.png")->setTopic("general_topic")->setClickAction("/news")->send();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/865813d996d2ee7673928ead5cb938bf4ff45e24cdf6f8dd363301a6ff5c0d40?d=identicon)[Agence Appy](/maintainers/Agence%20Appy)

---

Top Contributors

[![agence-appy](https://avatars.githubusercontent.com/u/92929363?v=4)](https://github.com/agence-appy "agence-appy (46 commits)")

### Embed Badge

![Health badge](/badges/appy-fcmhttpv1/health.svg)

```
[![Health](https://phpackages.com/badges/appy-fcmhttpv1/health.svg)](https://phpackages.com/packages/appy-fcmhttpv1)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
