Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"name": "kreait/laravel-firebase",
"name": "cybrary/laravel-firebase",
"description": "A Laravel package for the Firebase PHP Admin SDK",
"keywords": ["laravel", "firebase", "fcm", "gcm"],
"keywords": [
"laravel",
"firebase",
"fcm",
"gcm"
],
"type": "library",
"license": "MIT",
"authors": [
Expand All @@ -11,10 +16,10 @@
}
],
"require": {
"php": "^7.2|~8.0.0",
"kreait/firebase-php": "^5.18",
"illuminate/contracts": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0"
"php": "^7.2|~8.0.0| ^8.1",
"kreait/firebase-php": "^6.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0"
},
"require-dev": {
"orchestra/testbench": "^4.0|^5.0|^6.0",
Expand Down Expand Up @@ -42,6 +47,7 @@
"aliases": {
"Firebase": "Kreait\\Laravel\\Firebase\\Facades\\Firebase",
"FirebaseAuth": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseAuth",
"FirebaseIdentityPlatform": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseIdentityPlatform",
"FirebaseDatabase": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseDatabase",
"FirebaseDynamicLinks": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseDynamicLinks",
"FirebaseFirestore": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseFirestore",
Expand All @@ -50,5 +56,11 @@
"FirebaseStorage": "Kreait\\Laravel\\Firebase\\Facades\\FirebaseStorage"
}
}
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Cybrary/firebase-php"
}
]
}
19 changes: 19 additions & 0 deletions src/Facades/FirebaseIdentityPlatform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Kreait\Laravel\Firebase\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Kreait\Firebase\Contract\IdentityPlatform
* @deprecated 3.0 Use {@see \Kreait\Laravel\Firebase\Facades\Firebase::auth()} instead.
*/
final class FirebaseIdentityPlatform extends Facade
{
protected static function getFacadeAccessor()
{
return 'firebase.identity_platform';
}
}
13 changes: 13 additions & 0 deletions src/FirebaseProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class FirebaseProject
/** @var \Kreait\Firebase\Contract\Firestore|null */
protected $firestore;

/** @var \Kreait\Firebase\Contract\IdentityPlatform|null */
protected $identityPlatform;

/** @var \Kreait\Firebase\Contract\Messaging|null */
protected $messaging;

Expand All @@ -50,6 +53,16 @@ public function auth(): Firebase\Contract\Auth
return $this->auth;
}

public function identityPlatform(): Firebase\IdentityPlatform
{
if (!$this->identityPlatform) {
$this->identityPlatform = $this->factory->createIdentityPlatform();
}

return $this->identityPlatform;
}


public function database(): Firebase\Contract\Database
{
if (!$this->database) {
Expand Down
14 changes: 8 additions & 6 deletions src/FirebaseProjectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,15 @@ protected function configure(string $name): FirebaseProject
if ($defaultStorageBucket = $config['storage']['default_bucket'] ?? null) {
$factory = $factory->withDefaultStorageBucket($defaultStorageBucket);
}
if ($logChannel = $config['logging']['http_debug_log_channel'] ?? null) {
$factory = $factory->withHttpDebugLogger(
$this->app->make('log')->channel($logChannel)
);
}

if ($config['debug'] ?? false) {
$factory = $factory->withEnabledDebug();
$logger = $this->app->make('log')->channel($logChannel ?? null);
$factory = $factory->withEnabledDebug($logger);
}

if ($cacheStore = $config['cache_store'] ?? null) {
Expand All @@ -100,11 +106,7 @@ protected function configure(string $name): FirebaseProject
);
}

if ($logChannel = $config['logging']['http_debug_log_channel'] ?? null) {
$factory = $factory->withHttpDebugLogger(
$this->app->make('log')->channel($logChannel)
);
}


$options = HttpClientOptions::default();

Expand Down
5 changes: 5 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ private function registerComponents(): void
return $app->make(FirebaseProjectManager::class)->project()->storage();
});
$this->app->alias(Firebase\Storage::class, 'firebase.storage');

$this->app->singleton(Firebase\IdentityPlatform::class, static function (Container $app) {
return $app->make(FirebaseProjectManager::class)->project()->identityPlatform();
});
$this->app->alias(Firebase\IdentityPlatform::class, 'firebase.identity_platform');
}

private function registerManager(): void
Expand Down