2

I am attempting to use the php-resque composer package via artisan. I believe Laravel is v3.2.7. When running the command php artisan queue I get the error:

Error

PHP Fatal error:  Class 'Resque' not found in /var/www/dev/application/tasks/queue.php on line 20

Fatal error: Class 'Resque' not found in /var/www/dev/application/tasks/queue.php on line 20

What seems to be the problem here? The php-resque package appears to have been installed to the vendor directory...

PHP (queue.php)

class Queue_Task
{
    public function run()
    {

        // Autoload composer vendors.
        require path('composer').DS.'autoload.php';

        // You can pass arguments into the worker as payload
        $args = array('name' => 'John Smith');
        Resque::enqueue('testqueue', 'ExampleWorker', $args);

        echo "Resque job queued.\n";
        return;
    }
}

public/index.php

// --------------------------------------------------------------
// Tick... Tock... Tick... Tock...
// --------------------------------------------------------------
define('LARAVEL_START', microtime(true));

// --------------------------------------------------------------
// Indicate that the request is from the web.
// --------------------------------------------------------------
$web = true;

// --------------------------------------------------------------
// Set the core Laravel path constants.
// --------------------------------------------------------------
require '../paths.php';

// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').'autoload.php';

// --------------------------------------------------------------
// Unset the temporary web variable.
// --------------------------------------------------------------
unset($web);

// --------------------------------------------------------------
// Launch Laravel.
// --------------------------------------------------------------
require path('sys').'laravel.php';

// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').DS.'autoload.php';

paths.php snippet

// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
  • Is `Resque` in your include path somewhere? Does composer know where to find it? – Halcyon Mar 04 '13 at 16:16
  • I updated the original post to show my `public/index.php` file. It contains the path to the composer directory `path('composer')`. Is that sufficient? – Nyxynyx Mar 04 '13 at 16:17
  • Youre missing a DIRECTORY_SEPARATOR for your composer path... But would think that would blow up on require... – prodigitalson Mar 04 '13 at 16:26

1 Answers1

2

Youre missing a DIRECTORY_SEPARATOR for your composer path.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114