From 86fa39449cee550958e7ee04005ff6ad1778ae1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Wed, 23 Oct 2019 10:34:07 +0200 Subject: [PATCH] Add support for Firestore --- CHANGELOG.md | 5 +++++ README.md | 13 +++++++------ composer.json | 2 +- src/Facades/FirebaseFirestore.php | 19 +++++++++++++++++++ src/ServiceProvider.php | 5 +++++ 5 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 src/Facades/FirebaseFirestore.php diff --git a/CHANGELOG.md b/CHANGELOG.md index db48146..a3b6f75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## Unreleased + +* Updated `kreait/firebase-php` to `^4.35.0` +* Added Firestore to the Service Provider and as `FirebaseFirestore` facade + ## 1.1.0 - 2019-09-19 * Updated `kreait/firebase-php` to `^4.32.0` diff --git a/README.md b/README.md index c25795d..2b9aa50 100644 --- a/README.md +++ b/README.md @@ -67,12 +67,13 @@ php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" | Component | [Automatic Injection](https://laravel.com/docs/5.8/container#automatic-injection) | [Facades](https://laravel.com/docs/facades) | [`app()`](https://laravel.com/docs/helpers#method-app) | | --- | --- | --- | --- | -| [Authentication](https://firebase-php.readthedocs.io/en/latest/authentication.html) | `\Kreait\Firebase\Auth` | `FirebaseAuth` | `app('firebase.auth')` | -| [Cloud Messaging (FCM)](https://firebase-php.readthedocs.io/en/latest/cloud-messaging.html) | `\Kreait\Firebase\Messaging` | `FirebaseMessaging` | `app('firebase.messaging')` | -| [Dynamic Links](https://firebase-php.readthedocs.io/en/latest/dynamic-links.html) | `\Kreait\Firebase\DynamicLinks` | `FirebaseDynamicLinks` | `app('firebase.dynamic_links')` | -| [Realtime Database](https://firebase-php.readthedocs.io/en/latest/realtime-database.html) | `\Kreait\Firebase\Database` | `FirebaseDatabase` | `app('firebase.database')` | -| [Remote Config](https://firebase-php.readthedocs.io/en/latest/remote-config.html) | `\Kreait\Firebase\RemoteConfig` | `FirebaseRemoteConfig` | `app('firebase.remote_config')` | -| [Storage](https://firebase-php.readthedocs.io/en/latest/storage.html) | `\Kreait\Firebase\Storage` | `FirebaseStorage` | `app('firebase.storage')` | +| [Authentication](https://firebase-php.readthedocs.io/en/stable/authentication.html) | `\Kreait\Firebase\Auth` | `FirebaseAuth` | `app('firebase.auth')` | +| [Cloud Firestore](https://firebase-php.readthedocs.io/en/stable/cloud-firestore.html) | `\Kreait\Firebase\Firestore` | `FirebaseFirestore` | `app('firebase.firestore')` | +| [Cloud Messaging (FCM)](https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html) | `\Kreait\Firebase\Messaging` | `FirebaseMessaging` | `app('firebase.messaging')` | +| [Dynamic Links](https://firebase-php.readthedocs.io/en/stable/dynamic-links.html) | `\Kreait\Firebase\DynamicLinks` | `FirebaseDynamicLinks` | `app('firebase.dynamic_links')` | +| [Realtime Database](https://firebase-php.readthedocs.io/en/stable/realtime-database.html) | `\Kreait\Firebase\Database` | `FirebaseDatabase` | `app('firebase.database')` | +| [Remote Config](https://firebase-php.readthedocs.io/en/stable/remote-config.html) | `\Kreait\Firebase\RemoteConfig` | `FirebaseRemoteConfig` | `app('firebase.remote_config')` | +| [Storage](https://firebase-php.readthedocs.io/en/stable/storage.html) | `\Kreait\Firebase\Storage` | `FirebaseStorage` | `app('firebase.storage')` | Once you have retrieved a component, please refer to the [documentation of the Firebase PHP Admin SDK](https://firebase-php.readthedocs.io) for further information on how to use it. diff --git a/composer.json b/composer.json index 516f7a5..f14fffc 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "kreait/firebase-php": "^4.32.0", + "kreait/firebase-php": "^4.35.0", "illuminate/contracts": "^5.8|^6.0", "illuminate/support": "^5.8|^6.0" }, diff --git a/src/Facades/FirebaseFirestore.php b/src/Facades/FirebaseFirestore.php new file mode 100644 index 0000000..4305f37 --- /dev/null +++ b/src/Facades/FirebaseFirestore.php @@ -0,0 +1,19 @@ +app->alias(Firebase\DynamicLinks::class, 'firebase.dynamic_links'); + $this->app->singleton(Firebase\Firestore::class, static function (Application $app) { + return $app->make(Firebase\Factory::class)->createFirestore(); + }); + $this->app->alias(Firebase\Firestore::class, 'firebase.firestore'); + $this->app->singleton(Firebase\Messaging::class, static function (Application $app) { return $app->make(Firebase\Factory::class)->createMessaging(); });