iaejean / firebase-bundle

A Symfony Bundle for the Firebase PHP Admin SDK

Home Page:https://github.com/kreait/firebase-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firebase SDK Bundle

A Symfony Bundle for the Firebase PHP SDK.

Current version Build Status GitHub license Total Downloads Discord


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.other_project.*

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'

Support

For bug reports and feature requests, use the issue tracker.

For help with and discussion about the PHP SDK and Bundle, join the Gitter Channel dedicated to this library.

For questions about Firebase in general, use Stack Overflow or join the Firebase Slack Community.

About

A Symfony Bundle for the Firebase PHP Admin SDK

https://github.com/kreait/firebase-php

License:MIT License


Languages

Language:PHP 95.9%Language:Makefile 4.1%