Developed with love by KnpLabs Hire us for your project!
77

firebase-bundle

by kreait

A Symfony Bundle for the Firebase PHP Admin SDK

Firebase SDK Bundle

A Symfony Bundle for the Firebase PHP SDK.

Current version
Build Status
GitHub license
Total Downloads
Discord
Sponsor

Table of Contents

Overview

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.

Installation

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],
];

Configuration

Minimal

# app/config/config.yml (Symfony without Flex)
# config/packages/firebase.yaml (Symfony with Flex)
kreait_firebase:
    projects:
        my_project:
            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.storage
  • 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

Full

# app/config/config.yml (Symfony without Flex)
# config/packages/firebase.yaml (Symfony with Flex)
kreait_firebase:
    projects:
        my_project:
            # Optional: Path to the project's Service Account credentials file
            # If omitted, the credentials will be auto-dicovered as described
            # in https://firebase-php.readthedocs.io/en/stable/setup.html#with-autodiscovery
            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: 'https://my_project.firebaseio.com'
            # Optional: Default domain for Dynamic Links
            default_dynamic_links_domain: 'https://my_project.page.link'
            # Optional: Used to cache Google's public keys. Must implement
            # \Psr\SimpleCache\CacheInterface (PSR-16)
            verifier_cache: 'cache.app'

Documentation

Support

License

Firebase Admin PHP SDK is licensed under the MIT License.

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

The MIT License (MIT)

Copyright (c) 2016 Jérôme Gamez, https://github.com/jeromegamez <jerome@gamez.name>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  • Release 2.1.0
    By jeromegamez, 8 months ago
  • Add support for both PSR-6 and PSR-16 caches
    By jeromegamez, 8 months ago
  • Rename main branch
    By jeromegamez, 8 months ago
  • Update FUNDING.yml
    By jeromegamez, 9 months ago
  • Add stale action
    By web-flow, 10 months ago
  • Restore indentations
    By jeromegamez, 11 months ago
  • Release 2.0.0
    By jeromegamez, 11 months ago
  • Update documentation
    By jeromegamez, 11 months ago
  • Add code style checks
    By jeromegamez, 11 months ago
  • Change directory structure
    By jeromegamez, 11 months ago
  • Update kreait/firebase-php to ^5.0
    By jeromegamez, 11 months ago
  • Release 1.10.0
    By jeromegamez, 11 months ago
  • Add sponsoring opportunities
    By jeromegamez, 11 months ago
  • Drop PHP 7.4 "snapshot" suffix
    By jeromegamez, 11 months ago
  • Add support for Dynamic Links
    By jeromegamez, 11 months ago
  • Update symfony/cache 3.4 (CVE-2019-10912)
    By jeromegamez, 1 year ago
  • Release 1.9.0
    By jeromegamez, 1 year ago
  • Update changelog
    By jeromegamez, 1 year ago
  • Allow credentials to be provided as an array (#20)
    By web-flow, 1 year ago
  • Release 1.8.0
    By jeromegamez, 1 year ago
  • Make verifier cache configurable
    By jeromegamez, 1 year ago
  • Test all supported PHP and Symfony versions
    By jeromegamez, 1 year ago
  • Drop support for unsupported Symfony versions
    By jeromegamez, 1 year ago
  • Release 1.7.0
    By jeromegamez, 1 year ago
  • Add support for Symfony 5
    By jeromegamez, 1 year ago
  • Release 1.6.1
    By jeromegamez, 1 year ago
  • Upgrade symfony/dependency-injection
    By jeromegamez, 1 year ago
  • Release 1.6.0
    By jeromegamez, 1 year ago
  • Provide default services via class name
    By jeromegamez, 1 year ago
  • Deprecate "alias" option and update documentation
    By jeromegamez, 1 year ago