Anthony
Anthony

Reputation: 5433

Class 'Pheanstalk_Pheanstalk' not found in Laravel 4 with Beanstalk

I'm trying to get beanstalk up and running and I'm getting the exception when trying to run Queue::push():

Class 'Pheanstalk_Pheanstalk' not found

I've run composer require pda/pheanstalk, and even regenerated my auto-load file an extra time.

It's happening in ./vendor/laravel/framework/src/Illuminate/Queue/Connectors/BeanstalkdConnector.php

Any ideas?

Upvotes: 5

Views: 3929

Answers (4)

Webeng
Webeng

Reputation: 7133

If you are using a version such as 2.1.1, and if you are using a namespace use Pheanstalk\Pheanstalk, then that might be the issue (it was for me). Version 2.1.1 isn't compatible with using namespaces, hence you would delete the use ... line and then, when initiating an instance of class type Pheanstalk, you do it as follows:

$pheanstalkObject = new Pheanstalk_Pheanstalk('127.0.0.1');

Upvotes: 0

Bouke Versteegh
Bouke Versteegh

Reputation: 4677

You may be using pheanstalk 3 which didn't work for me with Laravel 4. Use this command to switch to an older version:

composer require pda/pheanstalk "~2.1"

Upvotes: 1

Jerome Jaglale
Jerome Jaglale

Reputation: 1873

In composer.json, replace the pda/pheanstalk requirement line by

"pda/pheanstalk": "2.0.*"

Run

composer update

Warning: will also update Laravel.

Source: http://laravel.io/forum/07-17-2014-class-pheanstalk-pheanstalk-not-found

Upvotes: 9

Anthony
Anthony

Reputation: 5433

Disregard. Found the answer at https://github.com/laravel/framework/issues/746. Apparently the newest version has been reorganized or something.

Upvotes: 2

Related Questions