Code Monkey home page Code Monkey logo

firebase-bundle's Introduction

Firebase SDK Bundle

A Symfony Bundle for the Firebase PHP SDK.

Current version Monthly Downloads Total Downloads Tests 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\Contract\Auth
  • Kreait\Firebase\Contract\Database
  • Kreait\Firebase\Contract\Firestore
  • Kreait\Firebase\Contract\Messaging
  • Kreait\Firebase\Contract\RemoteConfig
  • Kreait\Firebase\Contract\Storage
  • Kreait\Firebase\Contract\DynamicLinks

To make it easier to use classes via dependency injection in the constructor of a class when multiple projects exist, you can do this in the constructor:

  • Kreait\Firebase\Contract\Auth $my_projectAuth
  • Kreait\Firebase\Contract\Database $my_projectDatabase
  • Kreait\Firebase\Contract\Firestore $my_projectFirestore
  • Kreait\Firebase\Contract\Messaging $my_projectMessaging
  • Kreait\Firebase\Contract\RemoteConfig $my_projectRemoteConfig
  • Kreait\Firebase\Contract\Storage $my_projectStorage
  • Kreait\Firebase\Contract\DynamicLinks $my_projectDynamicLinks

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-discovered as described
            # in https://firebase-php.readthedocs.io/en/stable/setup.html
            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: Make the client tenant aware
            tenant_id: 'tenant-id'
            # Optional: Default domain for Dynamic Links
            default_dynamic_links_domain: 'https://my_project.page.link'
            # Optional: Used to cache Google's public keys.
            verifier_cache: null # Example: cache.app
            # Optional: Used to cache the authentication tokens for connecting to the Firebase servers.
            auth_token_cache: null # Example: cache.app
            # 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

Documentation

Support

If you or your team rely on this project and me maintaining it, please consider becoming a Sponsor ๐Ÿ™. Higher tiers enable access to extended 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.

firebase-bundle's People

Contributors

jeromegamez avatar iamtankist avatar dependabot[bot] avatar aj-computerrock avatar alimsayleb avatar angelsilesbdo avatar eriwin avatar hossamyoussof avatar jeremiesamson avatar simonhayre avatar tjveldhuizen avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.