Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahoi's avatar
Level 5

Pusher\Pusher if I try to use the pusher broadcast connection

Hi there,

I followed https://laravel.com/docs/11.x/broadcasting#pusher-channels to make use of pusher channels.

I installed the pusher-sdk and enabled the pusher broadcasting connection in .env:

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"

Now I am facing an internal server error:

  Class "Pusher\Pusher" not found

  at vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php:341
    337▕                 $config['client_options'] ?? [],
    338▕             ),
    339▕         );
    340▕ 
  ➜ 341▕         $pusher = new Pusher(
    342▕             $config['key'],
    343▕             $config['secret'],
    344▕             $config['app_id'],
    345▕             $config['options'] ?? [],

The use-statement in that class:

use Pusher\Pusher;
0 likes
2 replies
LaryAI's avatar
Level 58

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:

  1. 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
    
  2. 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.php file.

  3. Configuration: Ensure your .env file 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"
    
  4. Clear Configuration Cache: Sometimes, Laravel caches the configuration, and changes to the .env file might not take effect immediately. Clear the configuration cache by running:

    php artisan config:cache
    
  5. Check the Broadcast Configuration: Ensure that your config/broadcasting.php file 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...
    ],
    
  6. Verify the Pusher Class Usage: Ensure that the use statement 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.

ahoi's avatar
Level 5

Solved it: For some reason, composer require pusher/pusher-php-server installed version 2.x. I upgraded it to 7.2.4, which works.

Please or to participate in this conversation.