Unable to respond to notification with ERROR: Class'App\Http\Controllers\Api\Firebase\Factory'not found error

Asked 1 years ago, Updated 1 years ago, 49 views

We are currently using the "firebase-php" library to support Push notifications within the EC2 server.

https://github.com/kreait/firebase-php

We are trying to install and test the notification confirmation, but we are unable to clear the error log below.

local.ERROR: Class'App\Http\Controllers\Api\Firebase\Factory'not found

I installed it using composer, but I am trying to find a path other than /home/ec2-user/vendor/kreait/firebase-php/src/firebase.

This may be a basic question, but I would appreciate it if you could tell me how to solve it.

use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;
use Kreait\Firebase\Messaging\CloudMessage;

(new Firebase\Factory())
    - > with ServiceAccount ([
        'type' = > 'direct input',
        'project_id' = > 'direct input',
        'client_id' = > 'direct input',
        'client_email' = > 'direct input',
        'private_key' = > 'direct input',
    ]) - > createMessaging()
    ->send(
        CloudMessage::withTarget('token', 'direct input')
            ->withNotification(
                Firebase\Messaging\Notification::create(
                    US>'Notification Test',
                    'Send from server'
                )
            )
    );

The code is like this.
For testing purposes, I have entered my ID and token directly.
I'm sorry to trouble you, but I appreciate your cooperation.

php laravel firebase

2022-09-29 22:29

1 Answers

 (new Firebase\Factory())

 (new Factory())

By changing to use Kreait\Firebase\Factory; Factory.


2022-09-29 22:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.