Symfony Bundle for the Firebase Admin SDK

Fund package maintenance!

Installs: 260 304

Dependents: 0

Suggesters: 0

Security: 0

Stars: 75

Watchers: 6

Forks: 14

Open Issues: 0


2.3.0 2020-10-04 12:20 UTC

This package is auto-updated.

Last update: 2021-01-04 09:23:53 UTC


A Symfony Bundle for the Firebase PHP SDK.

Current version Build Status GitHub license Total Downloads Sponsor

Table of Contents


Firebase provides the tools and infrastructure you need to develop your app, grow your user base, and earn money. The Firebase Admin PHP SDK enables access to Firebase services from privileged environments (such as servers or cloud) in PHP.

For more information, visit the Firebase Admin PHP SDK documentation.


Add the bundle using Composer

composer require kreait/firebase-bundle
// Symfony without Flex
// in %kernel.root_dir%/AppKernel.php
$bundles = array(
    // ...
    new Kreait\Firebase\Symfony\Bundle\FirebaseBundle(),

// Symfony with Flex
// in config/bundles.php
return [
    // ...
    Kreait\Firebase\Symfony\Bundle\FirebaseBundle::class => ['all' => true],



# app/config/config.yml (Symfony without Flex)
# config/packages/firebase.yaml (Symfony with Flex)
            credentials: '%kernel.project_dir%/config/my_project_credentials.json'
        other_project: # optional
            credentials: '%kernel.project_dir%/config/other_project_credentials.json'

The following services will be available for your project:

  • kreait_firebase.my_project.auth
  • kreait_firebase.my_project.database
  • kreait_firebase.my_project.firestore
  • kreait_firebase.my_project.messaging
  • kreait_firebase.my_project.remote_config
  • kreait_firebase.my_project.dynamic_links
  • kreait_firebase.other_project.*

The following classes will be available for dependency injection if you have configured only one project:

  • Kreait\Firebase\Auth
  • Kreait\Firebase\Database
  • Kreait\Firebase\Firestore
  • Kreait\Firebase\Messaging
  • Kreait\Firebase\RemoteConfig
  • Kreait\Firebase\Storage
  • Kreait\Firebase\DynamicLinks


# app/config/config.yml (Symfony without Flex)
# config/packages/firebase.yaml (Symfony with Flex)
            # Optional: Path to the project's Service Account credentials file
            # If omitted, the credentials will be auto-dicovered as described
            # in
            credentials: '%kernel.project_dir%/config/my_project_credentials.json'
            # Optional: If set to true, this project will be used when 
            # type hinting the component classes of the Firebase SDK,
            # e.g. Kreait\Firebase\Auth, Kreait\Firebase\Database,
            # Kreait\Firebase\Messaging, etc.
            default: false 
            # Optional: If set to false, the service and its alias can only be
            # used via dependency injection, and not be retrieved from the
            # container directly.
            public: true
            # Optional: Should only be used if the URL of your Realtime
            # Database can not be generated with the project id of the 
            # given Service Account
            database_uri: ''
            # Optional: Default domain for Dynamic Links
            default_dynamic_links_domain: ''
            # Optional: Used to cache Google's public keys. Must implement
            # \Psr\SimpleCache\CacheInterface (PSR-16)
            verifier_cache: null # Example:
            # If set, logs simple HTTP request and response statuses
            http_request_logger:  null # Example: monolog.logger.firebase
            # If set, logs detailed HTTP request and response statuses
            http_request_debug_logger: null # Example: monolog.logger.firebase_debug




Firebase Admin PHP SDK is licensed under the MIT License.

Your use of Firebase is governed by the Terms of Service for Firebase Services.