Skip to content

Commit 86fa394

Browse files
committed
Add support for Firestore
1 parent 9f0e4d9 commit 86fa394

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## Unreleased
4+
5+
* Updated `kreait/firebase-php` to `^4.35.0`
6+
* Added Firestore to the Service Provider and as `FirebaseFirestore` facade
7+
38
## 1.1.0 - 2019-09-19
49

510
* Updated `kreait/firebase-php` to `^4.32.0`

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider"
6767

6868
| 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) |
6969
| --- | --- | --- | --- |
70-
| [Authentication](https://firebase-php.readthedocs.io/en/latest/authentication.html) | `\Kreait\Firebase\Auth` | `FirebaseAuth` | `app('firebase.auth')` |
71-
| [Cloud Messaging (FCM)](https://firebase-php.readthedocs.io/en/latest/cloud-messaging.html) | `\Kreait\Firebase\Messaging` | `FirebaseMessaging` | `app('firebase.messaging')` |
72-
| [Dynamic Links](https://firebase-php.readthedocs.io/en/latest/dynamic-links.html) | `\Kreait\Firebase\DynamicLinks` | `FirebaseDynamicLinks` | `app('firebase.dynamic_links')` |
73-
| [Realtime Database](https://firebase-php.readthedocs.io/en/latest/realtime-database.html) | `\Kreait\Firebase\Database` | `FirebaseDatabase` | `app('firebase.database')` |
74-
| [Remote Config](https://firebase-php.readthedocs.io/en/latest/remote-config.html) | `\Kreait\Firebase\RemoteConfig` | `FirebaseRemoteConfig` | `app('firebase.remote_config')` |
75-
| [Storage](https://firebase-php.readthedocs.io/en/latest/storage.html) | `\Kreait\Firebase\Storage` | `FirebaseStorage` | `app('firebase.storage')` |
70+
| [Authentication](https://firebase-php.readthedocs.io/en/stable/authentication.html) | `\Kreait\Firebase\Auth` | `FirebaseAuth` | `app('firebase.auth')` |
71+
| [Cloud Firestore](https://firebase-php.readthedocs.io/en/stable/cloud-firestore.html) | `\Kreait\Firebase\Firestore` | `FirebaseFirestore` | `app('firebase.firestore')` |
72+
| [Cloud Messaging (FCM)](https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html) | `\Kreait\Firebase\Messaging` | `FirebaseMessaging` | `app('firebase.messaging')` |
73+
| [Dynamic Links](https://firebase-php.readthedocs.io/en/stable/dynamic-links.html) | `\Kreait\Firebase\DynamicLinks` | `FirebaseDynamicLinks` | `app('firebase.dynamic_links')` |
74+
| [Realtime Database](https://firebase-php.readthedocs.io/en/stable/realtime-database.html) | `\Kreait\Firebase\Database` | `FirebaseDatabase` | `app('firebase.database')` |
75+
| [Remote Config](https://firebase-php.readthedocs.io/en/stable/remote-config.html) | `\Kreait\Firebase\RemoteConfig` | `FirebaseRemoteConfig` | `app('firebase.remote_config')` |
76+
| [Storage](https://firebase-php.readthedocs.io/en/stable/storage.html) | `\Kreait\Firebase\Storage` | `FirebaseStorage` | `app('firebase.storage')` |
7677

7778
Once you have retrieved a component, please refer to the [documentation of the Firebase PHP Admin SDK](https://firebase-php.readthedocs.io)
7879
for further information on how to use it.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"kreait/firebase-php": "^4.32.0",
14+
"kreait/firebase-php": "^4.35.0",
1515
"illuminate/contracts": "^5.8|^6.0",
1616
"illuminate/support": "^5.8|^6.0"
1717
},

src/Facades/FirebaseFirestore.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Kreait\Laravel\Firebase\Facades;
6+
7+
use Illuminate\Support\Facades\Facade;
8+
9+
/**
10+
* @see \Kreait\Firebase\Firestore
11+
* @mixin \Kreait\Firebase\Firestore
12+
*/
13+
final class FirebaseFirestore extends Facade
14+
{
15+
protected static function getFacadeAccessor()
16+
{
17+
return 'firebase.firestore';
18+
}
19+
}

src/ServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ private function registerComponents()
7575
});
7676
$this->app->alias(Firebase\DynamicLinks::class, 'firebase.dynamic_links');
7777

78+
$this->app->singleton(Firebase\Firestore::class, static function (Application $app) {
79+
return $app->make(Firebase\Factory::class)->createFirestore();
80+
});
81+
$this->app->alias(Firebase\Firestore::class, 'firebase.firestore');
82+
7883
$this->app->singleton(Firebase\Messaging::class, static function (Application $app) {
7984
return $app->make(Firebase\Factory::class)->createMessaging();
8085
});

0 commit comments

Comments
 (0)