Queue::push Unable To Find Class

- 1 answer

  • Laravel Version: 5.1.46 (LTS)
  • PHP Version: PHP 7.0.15-0ubuntu0.16.04.4 (cli) ( NTS )


Using Queue::push is causing me some headaches on my production server:

$data = [
    'server' => $server,
    'week' => '201427'

Queue::push('\Cleanse\MyPluginName\Classes\Jobs\MyQueueClass', $data);

exception 'ReflectionException' with message 'Class \Cleanse\MyPluginName\Classes\Jobs\MyQueueClass does not exist' in /october/vendor/laravel/framework/src/Illuminate/Container/Container.php:741

It works fine on my local Mac server I develop on, but after uploading to my live server, I am getting the error above.

I have also tried using a closure, but I get:

Queue::push(function($job) use ($data) {
    $crawl = new RankingsUpdate();


[2017-05-30 02:41:33] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Cleanse\MyPluginName\Classes\CategoryDir\CategoryClass' not found in /var/www/html/vendor/jeremeamia/SuperClosure/src/SerializableClosure.php(210) : eval()'d code:8

Could it be a PHP version issue? It works on my MB Air, which is running PHP 7.0.11 (cli) (built: Sep 23 2016 20:33:19) ( NTS )



This is a common pitfall, make sure your folder names are lower case. Some operating systems are case sensitive.

For example the class \Cleanse\MyPluginName\Classes\Jobs\MyQueueClass should be stored in a file called plugins/cleanse/mypluginname/classes/jobs/MyQueueClass.php.