It looks like you're encountering an issue where the Pusher\Pusher class is not found. This typically happens when the Pusher PHP SDK is not installed or not autoloaded correctly. Here are the steps to resolve this issue:
-
Install the Pusher PHP SDK: Make sure you have the Pusher PHP SDK installed via Composer. Run the following command in your terminal:
composer require pusher/pusher-php-server -
Check Autoloading: Ensure that Composer's autoload file is being included in your project. This is usually done automatically, but you can verify it by checking the
vendor/autoload.phpfile. -
Configuration: Ensure your
.envfile is correctly configured. It looks like you have already done this, but double-check for any typos or missing values.BROADCAST_CONNECTION=pusher PUSHER_APP_ID="app-id" PUSHER_APP_KEY="app-key" PUSHER_APP_SECRET="app-secret" PUSHER_HOST= PUSHER_PORT=6001 PUSHER_SCHEME="https" PUSHER_APP_CLUSTER="ws1" -
Clear Configuration Cache: Sometimes, Laravel caches the configuration, and changes to the
.envfile might not take effect immediately. Clear the configuration cache by running:php artisan config:cache -
Check the Broadcast Configuration: Ensure that your
config/broadcasting.phpfile is correctly set up to use Pusher. It should look something like this:'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'useTLS' => true, 'host' => env('PUSHER_HOST'), 'port' => env('PUSHER_PORT'), 'scheme' => env('PUSHER_SCHEME'), ], ], // other connections... ], -
Verify the Pusher Class Usage: Ensure that the
usestatement for the Pusher class is correct in your code. It should be:use Pusher\Pusher;
By following these steps, you should be able to resolve the "Class 'Pusher\Pusher' not found" error. If the issue persists, double-check that the Pusher PHP SDK is correctly installed and autoloaded by Composer.