Laravel Firebase
Laravel Firebase stats
- Downloads
- 5.1M
- Stars
- 862
- Open Issues
- 3
- Forks
- 144
A Laravel package for the Firebase PHP Admin SDK
Firebase for Laravel
This Laravel package integrates your application with Firebase using the Firebase PHP Admin SDK, allowing seamless interaction with Firebase services directly from your Laravel projects.
Key Features
- Ease of Installation: Simply use Composer to get started with
composer require kreait/laravel-firebase. - Automatic Configuration: Leverages environment variables and Google's known paths for hassle-free setup of service accounts.
- Support for Multiple Projects: Easily manage multiple Firebase projects within the same Laravel application.
- Streamlined Usage: Utilizes Laravel's Service Providers, avoiding the need for manual SDK bootstrapping. Supports Dependency Injection and Facades for straightforward code.
- Active Support: Regular updates and security patches, with detailed version support aligned with Laravel's releases.
Installation and Configuration
Install the package via Composer:
composer require kreait/laravel-firebase
For authentication, set up a Firebase Service Account by downloading the JSON file and configuring the FIREBASE_DATABASE_URL in your .env file:
FIREBASE_DATABASE_URL=https://<your-project>.firebaseio.com
Further customize settings by publishing the config file to your Laravel config directory:
php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config
Usage
Access Firebase components using the Laravel facade without needing to instantiate new Factory objects:
use Kreait\Laravel\Firebase\Facades\Firebase; $defaultAuth = Firebase::auth(); // Default Firebase project$appAuth = Firebase::project('app')->auth(); // Specific Firebase project
Refer to the Firebase PHP Admin SDK documentation for more detailed usage instructions.
Supported Versions
This package only actively supports the latest version (5.x as of now), which is compatible with Laravel ^9.0. Older versions receive only security updates. Check the SDK’s README for a detailed look at supported versions across different Laravel releases.
This package is ideal for developers looking to leverage Firebase within their Laravel applications efficiently, with minimal setup and robust support for various Firebase functionalities.