Skip to content

Commit

Permalink
Defer Service Provider Registration
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Jun 23, 2024
1 parent 2ec5f02 commit 86e1dab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Service Provider Registration is now deferred. This should fix the credentials auto discovery in Laravel's
package discovery stage
([#210](https://github.com/kreait/laravel-firebase/pull/210))

## 5.8.0 - 2024-03-13

* Added support for Laravel 11
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"kreait/firebase-php": "^7.0",
"kreait/firebase-php": "^7.13",
"illuminate/contracts": "^9.0 || ^10.0 || ^11.0",
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
"symfony/cache": "^6.1.2 || ^7.0.3"
Expand Down
18 changes: 17 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
namespace Kreait\Laravel\Firebase;

use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Support\DeferrableProvider;
use Kreait\Firebase;

final class ServiceProvider extends \Illuminate\Support\ServiceProvider
final class ServiceProvider extends \Illuminate\Support\ServiceProvider implements DeferrableProvider
{
public function boot(): void
{
Expand Down Expand Up @@ -62,4 +63,19 @@ private function registerManager(): void
$this->app->singleton(FirebaseProjectManager::class, static fn (Container $app) => new FirebaseProjectManager($app));
$this->app->alias(FirebaseProjectManager::class, 'firebase.manager');
}

public function provides(): array
{
return [
Firebase\Contract\AppCheck::class,
Firebase\Contract\Auth::class,
Firebase\Contract\Database::class,
Firebase\Contract\DynamicLinks::class,
Firebase\Contract\Firestore::class,
Firebase\Contract\Messaging::class,
Firebase\Contract\RemoteConfig::class,
Firebase\Contract\Storage::class,
FirebaseProjectManager::class,
];
}
}

0 comments on commit 86e1dab

Please sign in to comment.