[GH-ISSUE #494] Class 'Pusher' not found #348

Closed
opened 2026-02-26 02:32:55 +03:00 by kerem · 17 comments
Owner

Originally created by @MQTEnt on GitHub (Dec 3, 2016).
Original GitHub issue: https://github.com/koel/koel/issues/494

When I install Koel, in step composer install when almost finish but an error occur

[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Pusher' not found
PHP Fatal error: Class 'Pusher' not found in \koel\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 210

Originally created by @MQTEnt on GitHub (Dec 3, 2016). Original GitHub issue: https://github.com/koel/koel/issues/494 When I install Koel, in step **composer install** when almost finish but an error occur > [Symfony\Component\Debug\Exception\FatalErrorException] > Class 'Pusher' not found > PHP Fatal error: Class 'Pusher' not found in \koel\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 210 >
kerem closed this issue 2026-02-26 02:32:55 +03:00
Author
Owner

@verygoodsoftwarenotvirus commented on GitHub (Dec 3, 2016):

I am also experiencing this.

Update: running composer require pusher/pusher-php-server --no-scripts caused it to stop displaying this error.

<!-- gh-comment-id:264638980 --> @verygoodsoftwarenotvirus commented on GitHub (Dec 3, 2016): I am also experiencing this. Update: running `composer require pusher/pusher-php-server --no-scripts` caused it to stop displaying this error.
Author
Owner

@phanan commented on GitHub (Dec 5, 2016):

Have you added BROADCAST_DRIVER=log into .env as instructed in the upgrade guide?

<!-- gh-comment-id:264778631 --> @phanan commented on GitHub (Dec 5, 2016): Have you added `BROADCAST_DRIVER=log` into `.env` as instructed in the upgrade guide?
Author
Owner

@binhex commented on GitHub (Dec 5, 2016):

I'm getting the same issue on a clean install (aka not upgrading), im assuming the .env file only comes into play when you attempt to init koel yes?, and thus i dont think adding in BROADCAST_DRIVER=log will fix this, output of error:-

`
php artisan clear-compiled

[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Pusher' not found
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 1
`

edit - @verygoodsoftwarenotvirus thanks for the workaround btw, worked for me, @phanan possible to include this in your install script?.

<!-- gh-comment-id:264820888 --> @binhex commented on GitHub (Dec 5, 2016): I'm getting the same issue on a clean install (aka not upgrading), im assuming the .env file only comes into play when you attempt to init koel yes?, and thus i dont think adding in `BROADCAST_DRIVER=log` will fix this, output of error:- ` php artisan clear-compiled [Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Pusher' not found Script php artisan clear-compiled handling the post-install-cmd event returned with error code 1 ` edit - @verygoodsoftwarenotvirus thanks for the workaround btw, worked for me, @phanan possible to include this in your install script?.
Author
Owner

@DaanOlbrechts commented on GitHub (Dec 5, 2016):

I suspect it is because in config/broadcasting.php the default for BROADCAST_DRIVER is set to "pusher".
During the installation process php artisan clear-compiled runs first (throwing the error) before php -r "if (!file_exists('.env')) copy('.env.example', '.env');".

Either changing the default value to log OR switching both installation instructions would fix this problem from occuring on fresh installations.
It also works when you supply your own .env file when installing. That file should contain the BROADCAST_DRIVER=log entry

<!-- gh-comment-id:264860250 --> @DaanOlbrechts commented on GitHub (Dec 5, 2016): I suspect it is because in config/broadcasting.php the default for BROADCAST_DRIVER is set to "pusher". During the installation process `php artisan clear-compiled` runs first (throwing the error) before `php -r "if (!file_exists('.env')) copy('.env.example', '.env');"`. Either changing the default value to log OR switching both installation instructions would fix this problem from occuring on fresh installations. It also works when you supply your own .env file when installing. That file should contain the `BROADCAST_DRIVER=log` entry
Author
Owner

@MQTEnt commented on GitHub (Dec 5, 2016):

@phanan okey, it works 👍
btw, I like your books very much :)

<!-- gh-comment-id:264893388 --> @MQTEnt commented on GitHub (Dec 5, 2016): @phanan okey, it works 👍 btw, I like your books very much :)
Author
Owner

@MQTEnt commented on GitHub (Dec 6, 2016):

I have an error again,

ErrorException in Application.php line 52:

It's the same issue #434 but I can't find the solution that works

<!-- gh-comment-id:265065008 --> @MQTEnt commented on GitHub (Dec 6, 2016): I have an error again, > ErrorException in Application.php line 52: It's the same issue #434 but I can't find the solution that works
Author
Owner

@Ex10Dios commented on GitHub (Jul 13, 2017):

If You want to use Pusher and in .env is "BROADCAST_DRIVER=pusher" You should edit line in "vendor/laravel/framework/src/illuminate/Broadcasting/BroadcastManager.php"
"use Pusher;" to "use Pusher\Pusher;"

<!-- gh-comment-id:315113610 --> @Ex10Dios commented on GitHub (Jul 13, 2017): If You want to use Pusher and in .env is "_BROADCAST_DRIVER=pusher_" You should edit line in "_vendor/laravel/framework/src/illuminate/Broadcasting/BroadcastManager.php_" "**use Pusher;**" to "**use Pusher\Pusher;**"
Author
Owner

@AhmadHani commented on GitHub (Jul 27, 2017):

i edit it but i have new problem

Argument 1 passed to Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::__construct() must be an instance of Pusher, instance of Pusher\Pusher given, called in C:\Users\Ahmed\Desktop\projects\social-network\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 215 and defined

 

<!-- gh-comment-id:318500691 --> @AhmadHani commented on GitHub (Jul 27, 2017): i edit it but i have new problem Argument 1 passed to Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::__construct() must be an instance of Pusher, instance of Pusher\Pusher given, called in C:\Users\Ahmed\Desktop\projects\social-network\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 215 and defined --  
Author
Owner

@tomdew commented on GitHub (Jul 28, 2017):

Try this: https://stackoverflow.com/questions/45052853/class-pusher-not-found
Just going through it the second answer seems to be working for me.

<!-- gh-comment-id:318533876 --> @tomdew commented on GitHub (Jul 28, 2017): Try this: https://stackoverflow.com/questions/45052853/class-pusher-not-found Just going through it the second answer seems to be working for me.
Author
Owner

@deangite commented on GitHub (Aug 21, 2017):

Install pusher 2.6 composer require pusher/pusher-php-server "~2.6"

<!-- gh-comment-id:323691776 --> @deangite commented on GitHub (Aug 21, 2017): Install pusher 2.6 `composer require pusher/pusher-php-server "~2.6"`
Author
Owner

@samayo commented on GitHub (Aug 24, 2017):

Still getting this error. This lib looked awesome and I was about to become a backer, but this needs to be fixed, I hope someone can fix it ... also thanks for making this. I was about to start making one from scratch :)

<!-- gh-comment-id:324598680 --> @samayo commented on GitHub (Aug 24, 2017): Still getting this error. This lib looked awesome and I was about to become a backer, but this needs to be fixed, I hope someone can fix it ... also thanks for making this. I was about to start making one from scratch :)
Author
Owner

@phanan commented on GitHub (Aug 24, 2017):

I don't see why setting BROADCAST_DRIVER=log in .env can't fix this "error."

<!-- gh-comment-id:324599364 --> @phanan commented on GitHub (Aug 24, 2017): I don't see why setting `BROADCAST_DRIVER=log` in `.env` can't fix this "error."
Author
Owner

@ghost commented on GitHub (Sep 4, 2017):

This worked for me.
A better way is to create an alias in config/app.php. Under the 'aliases' key, add this to the array in the "Third Party Aliases" section:

'Pusher' => Pusher\Pusher::class,

<!-- gh-comment-id:326845159 --> @ghost commented on GitHub (Sep 4, 2017): This worked for me. A better way is to create an alias in config/app.php. Under the 'aliases' key, add this to the array in the "Third Party Aliases" section: 'Pusher' => Pusher\Pusher::class,
Author
Owner

@evinkuraga commented on GitHub (Oct 13, 2017):

for laravel 5.5 users, just change your composer json line to this:
"pusher/pusher-php-server": "~3.0"

<!-- gh-comment-id:336478218 --> @evinkuraga commented on GitHub (Oct 13, 2017): for laravel 5.5 users, just change your composer json line to this: "pusher/pusher-php-server": "~3.0"
Author
Owner

@AhmedHdeawy commented on GitHub (Dec 30, 2017):

in your config/app.php add this line to aliases

'Pusher' => Pusher\Pusher::class,

<!-- gh-comment-id:354548111 --> @AhmedHdeawy commented on GitHub (Dec 30, 2017): in your config/app.php add this line to aliases 'Pusher' => Pusher\Pusher::class,
Author
Owner

@MQTEnt commented on GitHub (Jan 6, 2018):

thank for answering my question until now :))

<!-- gh-comment-id:355747439 --> @MQTEnt commented on GitHub (Jan 6, 2018): thank for answering my question until now :))
Author
Owner

@youssefshibl commented on GitHub (May 27, 2022):

for solve this problem -->
Argument 1 passed to Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::__construct() must be an instance of Pusher, instance of Pusher\Pusher given, called in C:\Users\Ahmed\Desktop\projects\social-network\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 215 and defined

you should run "cp .env.example .env"
and if you want to upload your website in heroku you should remove the ".env " file from .gitignor file

<!-- gh-comment-id:1139578063 --> @youssefshibl commented on GitHub (May 27, 2022): for solve this problem --> Argument 1 passed to Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::__construct() must be an instance of Pusher, instance of Pusher\Pusher given, called in C:\Users\Ahmed\Desktop\projects\social-network\vendor\laravel\framework\src\Illuminate\Broadcasting\BroadcastManager.php on line 215 and defined you should run "cp .env.example .env" and if you want to upload your website in heroku you should remove the ".env " file from .gitignor file
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#348
No description provided.