PHPackages                             tomatophp/laravel-firebase - 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. [Database &amp; ORM](/categories/database)
4. /
5. tomatophp/laravel-firebase

ActiveLibrary[Database &amp; ORM](/categories/database)

tomatophp/laravel-firebase
==========================

A Laravel package for the Firebase PHP Admin SDK

v1.0.0(2y ago)13.5k1MITPHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0

Since Mar 12Pushed 2y agoCompare

[ Source](https://github.com/tomatophp/laravel-firebase)[ Packagist](https://packagist.org/packages/tomatophp/laravel-firebase)[ GitHub Sponsors](https://github.com/jeromegamez)[ RSS](/packages/tomatophp-laravel-firebase/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (1)

Firebase for Laravel
====================

[](#firebase-for-laravel)

A Laravel package for the [Firebase PHP Admin SDK](https://github.com/kreait/firebase-php).

[![Current version](https://camo.githubusercontent.com/a46d8a144a065334ec363e0d4d1a1d30ae55dd54844df8b305ff70700039ced2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b72656169742f6c61726176656c2d66697265626173652e7376673f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/kreait/laravel-firebase)[![Monthly Downloads](https://camo.githubusercontent.com/3a07d03496349ae51a9f5af11d756d7a7004ed18c0b2e931438cd46f65d18a3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6b72656169742f6c61726176656c2d66697265626173652e737667)](https://packagist.org/packages/kreait/laravel-firebase/stats)[![Total Downloads](https://camo.githubusercontent.com/f2d35a240a00894054c9897ee0d980f4c81abe0eae7f6507f4dc9d71192d0217/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b72656169742f6c61726176656c2d66697265626173652e737667)](https://packagist.org/packages/kreait/laravel-firebase/stats)[![Tests](https://github.com/kreait/laravel-firebase/workflows/Tests/badge.svg?branch=main)](https://github.com/kreait/laravel-firebase/actions)[![codecov](https://camo.githubusercontent.com/5ac3cfc2cdafeffe77ff016f5ca911c3fb96e0ae07db04f5f5a1173f154593b8/68747470733a2f2f636f6465636f762e696f2f67682f6b72656169742f6c61726176656c2d66697265626173652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/kreait/laravel-firebase)[![Sponsor](https://camo.githubusercontent.com/1004a94551d1edaf2a6da4d45ba217b79a46eb18dd7dd2d7825add0a2a8ddc4f/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d476974487562266c6162656c3d53706f6e736f72266d6573736167653d25453225394425413426636f6c6f723d666636396234)](https://github.com/sponsors/jeromegamez)

---

The future of the Firebase Admin PHP SDK
----------------------------------------

[](#the-future-of-the-firebase-admin-php-sdk)

Please read about the future of the Firebase Admin PHP SDK on the [SDK's GitHub Repository](https://github.com/kreait/firebase-php).

---

- [Installation](#installation)
    - [Laravel](#laravel)
- [Configuration](#configuration)
    - [Credentials with JSON files](#credentials-with-json-files)
    - [Credentials with Arrays](#credentials-with-arrays)
- [Usage](#usage)
    - [Multiple projects](#multiple-projects)
- [Supported Versions](#supported-versions)
- [License](#license)

Installation
------------

[](#installation)

```
composer require kreait/laravel-firebase
```

Configuration
-------------

[](#configuration)

In order to access a Firebase project and its related services using a server SDK, requests must be authenticated. For server-to-server communication this is done with a Service Account.

If you don't already have generated a Service Account, you can do so by following the instructions from the official documentation pages at [https://firebase.google.com/docs/admin/setup#initialize\_the\_sdk](https://firebase.google.com/docs/admin/setup#initialize_the_sdk).

Once you have downloaded the Service Account JSON file, you can configure the package by specifying environment variables starting with `FIREBASE_` in your `.env` file. Usually, the following are required for the package to work:

```
# You can find the database URL for your project at
# https://console.firebase.google.com/project/_/database
FIREBASE_DATABASE_URL=https://.firebaseio.com

```

For further configuration, please see [config/firebase.php](config/firebase.php). You can modify the configuration by copying it to your local `config` directory or by defining the environment variables used in the config file:

```
# Laravel
php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config
```

### Credentials with JSON files

[](#credentials-with-json-files)

The package uses auto discovery for the default project to find the credentials needed for authenticating requests to the Firebase APIs by inspecting certain environment variables and looking into Google's well known path(s).

If you don't want a service account to be auto-discovered, provide it by setting the `FIREBASE_CREDENTIALS` or `GOOGLE_APPLICATION_CREDENTIALS` environment variable or by adapting the package configuration, like so for example:

```
FIREBASE_CREDENTIALS=storage/app/firebase-auth.json
```

### Credentials with Arrays

[](#credentials-with-arrays)

If you prefer to have more control over the configuration items required to configure the credentials, you can also transpose the Service Account JSON file as an array within your `config/firebase.php` file.

```
'credentials' => [
    'type' => 'service_account',
    'project_id' => 'some-project-123',
    'private_key_id' => '123456789',
    'private_key' => '-----BEGIN PRIVATE KEY-----\nFOO_BAR_123456789\n-----END PRIVATE KEY-----\n',
    'client_email' => 'firebase-adminsdk-cwiuo@some-project-123.iam.gserviceaccount.com',
    'client_id' => '123456789',
    'auth_uri' => 'https://accounts.google.com/o/oauth2/auth',
    'token_uri' => 'https://oauth2.googleapis.com/token',
    'auth_provider_x509_cert_url' => 'https://www.googleapis.com/oauth2/v1/certs',
    'client_x509_cert_url' => 'https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-cwiuo%40some-project-123.iam.gserviceaccount.com',
    'universe_domain' => 'googleapis.com',
],
```

Usage
-----

[](#usage)

Once you have retrieved a component, please refer to the [documentation of the Firebase PHP Admin SDK](https://firebase-php.readthedocs.io)for further information on how to use it.

**You don't need and should not use the `new Factory()` pattern described in the SDK documentation, this is already done for you with the Laravel Service Provider. Use Dependency Injection, the Facades or the `app()` helper instead**

### Multiple projects

[](#multiple-projects)

Multiple projects can be configured in [config/firebase.php](config/firebase.php) by adding another section to the projects array.

When accessing components, the facade uses the default project. You can also explicitly use a project:

```
use Kreait\Laravel\Firebase\Facades\Firebase;

// Return an instance of the Auth component for the default Firebase project
$defaultAuth = Firebase::auth();
// Return an instance of the Auth component for a specific Firebase project
$appAuth = Firebase::project('app')->auth();
$anotherAppAuth = Firebase::project('another-app')->auth();
```

Supported Versions
------------------

[](#supported-versions)

**Only the latest version is actively supported.**

Earlier versions will receive security fixes as long as their **lowest** SDK requirement receives security fixes. You can find the currently supported versions and support options in the [SDK's README](https://github.com/kreait/firebase-php).

VersionInitial ReleaseSupported SDK VersionsSupported Laravel VersionsStatus`5.x`13 Jan 2023`^7.0``^9.0`, `^10.0`Active`4.x`09 Jan 2022`^6.0``^8.0`End of life`3.x`01 Nov 2020`^5.24``^6.0, ^7.0, ^8.0`End of life`2.x`01 Apr 2020`^5.0``^5.8, ^6.0, ^7.0, ^8.0`End of life`1.x`17 Aug 2019`^4.40.1``^5.8, ^6.0, ^7.0`End of lifeLicense
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

Your use of Firebase is governed by the [Terms of Service for Firebase Services](https://firebase.google.com/terms/).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.9% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

797d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2147eb2fca7ab5f0124d0fafd88ba2d2a5dfa3a0036fb8872d1084b7cba29366?d=identicon)[fadymondy](/maintainers/fadymondy)

---

Top Contributors

[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (107 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")[![ankurk91](https://avatars.githubusercontent.com/u/6111524?v=4)](https://github.com/ankurk91 "ankurk91 (2 commits)")[![danikp](https://avatars.githubusercontent.com/u/3479747?v=4)](https://github.com/danikp "danikp (1 commits)")[![dododedodonl](https://avatars.githubusercontent.com/u/100052?v=4)](https://github.com/dododedodonl "dododedodonl (1 commits)")[![fadymondy](https://avatars.githubusercontent.com/u/11937812?v=4)](https://github.com/fadymondy "fadymondy (1 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (1 commits)")[![gregorip02](https://avatars.githubusercontent.com/u/62108989?v=4)](https://github.com/gregorip02 "gregorip02 (1 commits)")[![clemblanco](https://avatars.githubusercontent.com/u/668419?v=4)](https://github.com/clemblanco "clemblanco (1 commits)")[![kakajansh](https://avatars.githubusercontent.com/u/7093483?v=4)](https://github.com/kakajansh "kakajansh (1 commits)")[![kevinvayro](https://avatars.githubusercontent.com/u/43274520?v=4)](https://github.com/kevinvayro "kevinvayro (1 commits)")[![l-alexandrov](https://avatars.githubusercontent.com/u/14351652?v=4)](https://github.com/l-alexandrov "l-alexandrov (1 commits)")[![marcroberts](https://avatars.githubusercontent.com/u/43874?v=4)](https://github.com/marcroberts "marcroberts (1 commits)")[![nhaynes](https://avatars.githubusercontent.com/u/3440002?v=4)](https://github.com/nhaynes "nhaynes (1 commits)")[![sl0wik](https://avatars.githubusercontent.com/u/2696038?v=4)](https://github.com/sl0wik "sl0wik (1 commits)")[![theadeyemiolayinka](https://avatars.githubusercontent.com/u/64863320?v=4)](https://github.com/theadeyemiolayinka "theadeyemiolayinka (1 commits)")[![tomykho](https://avatars.githubusercontent.com/u/1904533?v=4)](https://github.com/tomykho "tomykho (1 commits)")

---

Tags

apilaravelsdkdatabasegcmfirebaseFCM

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/tomatophp-laravel-firebase/health.svg)

```
[![Health](https://phpackages.com/badges/tomatophp-laravel-firebase/health.svg)](https://phpackages.com/packages/tomatophp-laravel-firebase)
```

###  Alternatives

[kreait/laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

1.3k16.5M42](/packages/kreait-laravel-firebase)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

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