PHP / Laravel build doesn't work on Heroku, artisan command is missing PHP class

I have an app configured with Heroku with setup Procfile

and composer.lock

removed from .gitignore

. The app is a Laravel 4.2 installation with a custom artisan command that emails every email every Friday; it is very simple and nothing complicated.

The command is in app/commands

, and the (sendEmail) class is registered in app/start/artisan.php

. I don't know if I need to combine with composer.json to autoload the class, but I feel like it's already included since any classes in are app/

already loaded automatically.

Here's what happens after I click on Heroku:

vagrant@homestead:~/Code/email-schedule/email-schedule$ git push heroku master
Enter passphrase for key '/home/vagrant/.ssh/id_rsa':
Initializing repository, done.
Counting objects: 76, done.
Compressing objects: 100% (63/63), done.
Writing objects: 100% (76/76), 33.09 KiB | 0 bytes/s, done.
Total 76 (delta 2), reused 0 (delta 0)

-----> PHP app detected
-----> No runtime requirements in composer.json, defaulting to PHP 5.6.0.
-----> Installing system packages...
       - PHP 5.6.0
       - Apache 2.4.10
       - Nginx 1.6.0
-----> Installing PHP extensions...
       - zend-opcache (automatic; bundled, using 'ext-zend-opcache.ini')
-----> Installing dependencies...
       Composer version 69afedb49c48239e4bb7219ec1bc2e1ee5b83595 2014-09-24 18:19:25
       Loading composer repositories with package information
       Installing dependencies from lock file
         - Installing guzzlehttp/streams (2.1.0)
           Downloading: 100%

         - Installing guzzlehttp/guzzle (4.2.2)
           Downloading: 100%

         - Installing symfony/translation (v2.5.4)
           Downloading: 100%

         - Installing symfony/security-core (v2.5.4)
           Downloading: 100%

         - Installing symfony/routing (v2.5.4)
           Downloading: 100%

         - Installing symfony/process (v2.5.4)
           Downloading: 100%

         - Installing symfony/http-foundation (v2.5.4)
           Downloading: 100%

         - Installing symfony/event-dispatcher (v2.5.4)
           Downloading: 100%

         - Installing symfony/debug (v2.5.4)
           Downloading: 100%

         - Installing psr/log (1.0.0)
           Downloading: 100%

         - Installing symfony/http-kernel (v2.5.4)
           Downloading: 100%

         - Installing symfony/finder (v2.5.4)
           Downloading: 100%

         - Installing symfony/dom-crawler (v2.5.4)
           Downloading: 100%

         - Installing symfony/css-selector (v2.5.4)
           Downloading: 100%

         - Installing symfony/console (v2.5.4)
           Downloading: 100%

         - Installing symfony/browser-kit (v2.5.4)
           Downloading: 100%

         - Installing swiftmailer/swiftmailer (v5.2.2)
           Downloading: 100%

         - Installing stack/builder (v1.0.2)
           Downloading: 100%

         - Installing predis/predis (v0.8.7)
           Downloading: 100%

         - Installing phpseclib/phpseclib (0.3.8)
           Downloading: 100%

         - Installing patchwork/utf8 (v1.1.25)
           Downloading: 100%

         - Installing nesbot/carbon (1.12.0)
           Downloading: 100%

         - Installing monolog/monolog (1.10.0)
           Downloading: 100%

         - Installing nikic/php-parser (v0.9.5)
           Downloading: 100%

         - Installing jeremeamia/superclosure (1.0.1)
           Downloading: 100%

         - Installing ircmaxell/password-compat (1.0.3)
           Downloading: 100%

         - Installing filp/whoops (1.1.2)
           Downloading: 100%

         - Installing d11wtq/boris (v1.0.8)
           Downloading: 100%

         - Installing symfony/filesystem (v2.5.4)
           Downloading: 100%

         - Installing classpreloader/classpreloader (1.0.2)
           Downloading: 100%

         - Installing laravel/framework (v4.2.9)
           Downloading: 100%

       Generating optimized autoload files
       PHP Fatal error:  Class 'sendEmail' not found in /tmp/build_69f41eb6-2466-44d0-9930-452a65fa422a/app/start/artisa
n.php on line 14
       {"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'sendEmail' not fou
nd","file":"\/tmp\/build_69f41eb6-2466-44d0-9930-452a65fa422a\/app\/start\/artisan.php","line":14}}Script php artisan cl
ear-compiled handling the post-install-cmd event returned with an error




  [RuntimeException]

  Error Output: PHP Fatal error:  Class 'sendEmail' not found in /tmp/build_69f41eb6-2466-44d0-9930-452a65fa422a/app/sta
rt/artisan.php on line 14






install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-s
cripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]



 !     Push rejected, failed to compile PHP app

To git@heroku.com:xxxx.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:xxxx.git'

      

I have tried different things, such as artisan optimize

, composer dump-autoload

, artisan clear-compiled

, and nothing works. It looks like Artisan was caching my own command class somewhere and Heroku is trying to access it, but I'm not entirely sure. How do I fix the missing class error?

+3


source to share





All Articles