kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
992 stars 163 forks source link

Class "Kreait\Laravel\Firebase\ServiceProvider\" not found #131

Closed TylerByte666 closed 2 years ago

TylerByte666 commented 2 years ago

Good day all.

I am using laravel sail and I followed the instructions:

  1. Require the package:

    composer require kreait/firebase-php
  2. Add the service:

    <?php
    // config/app.php
    return [
    // ...
    'providers' => [
        // ...
        Kreait\Laravel\Firebase\ServiceProvider::class
    ]
    // ...
    ];

But the logs I get when trying to start using sail up:

./vendor/bin/sail up
laravel.test_1  | In ProviderRepository.php line 208:                                                    
laravel.test_1  |   Class "Kreait\Laravel\Firebase\ServiceProvider" not found 

I am not sure what I am doing wrong? This is what I get from my API endpoint:

{
    "message": "Class \"Kreait\\Laravel\\Firebase\\ServiceProvider\" not found",
    "exception": "Error",
    "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php",
    "line": 208,
    "trace": [
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php",
            "line": 144,
            "function": "createProvider",
            "class": "Illuminate\\Foundation\\ProviderRepository",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php",
            "line": 61,
            "function": "compileManifest",
            "class": "Illuminate\\Foundation\\ProviderRepository",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php",
            "line": 663,
            "function": "load",
            "class": "Illuminate\\Foundation\\ProviderRepository",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php",
            "line": 17,
            "function": "registerConfiguredProviders",
            "class": "Illuminate\\Foundation\\Application",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php",
            "line": 239,
            "function": "bootstrap",
            "class": "Illuminate\\Foundation\\Bootstrap\\RegisterProviders",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 153,
            "function": "bootstrapWith",
            "class": "Illuminate\\Foundation\\Application",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 137,
            "function": "bootstrap",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 111,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/var/www/html/public/index.php",
            "line": 52,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php",
            "line": 16,
            "function": "require_once"
        }
    ]
}
jeromegamez commented 2 years ago

You don't need to add the Service Provider if you haven't disabled Laravel's package auto-discovery.

Unfortunately I have no experience with Laravel Sail, but since the package is working without it, I assume it has something to do with the sail setup 🤔

TylerByte666 commented 2 years ago

You right!

I installed a fresh sail project, started with your plugin.

After the composer install this time, it revealed that the packages were discovered.

Thank you so much!

jeromegamez commented 2 years ago

Glad I could help 🙌 , even if it was just by saying that I don't know 😅