Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abbood's avatar

How can I make envoyer run composer update instead of composer install

Problem

This is a weird one. I simply added this to my composer.json file:

"maatwebsite/excel": "~2.1.0"

yet when I run composer install, that library doesn't get installed:

composer show | grep excel

returns nothing.

and so everytime I run my deployment script I get this error:

> php artisan clear-compiled
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'PHPExcel_Shared_Font' not found in /Users/Shared/dev/php/toters-api/config/excel.php:182
Stack trace:
#0 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(60): require()
#1 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(38): Illuminate\Foundation\Bootstrap\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\Foundation\Application), Object(Illuminate\Config\Repository))
#2 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap(Object(Illuminate\Foundation\Application))
#3 /Users/Shared/dev/php/toters-api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#4 /Users/Shared/dev/php/toters-api/vendor/laravel/framew in /Users/Shared/dev/php/toters-api/config/excel.php on line 182

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'PHPExcel_Shared_Font' not found in /Users/Shared/dev/php/toters-api/config/excel.php on line 182

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'PHPExcel_Shared_Font' not found in /Users/Shared/dev/php/toters-api/config/excel.php on line 182

which is an expected error as composer is ignoring my maatwebsite/excel library!

Workaround

I use these steps to brute force it into working:

rm -rf vendor
rm composer.lock
composer install --no-scripts

but this is clearly an ugly and expensive hack (I've added it as a pre-hook in the envoyer auto deployment), and it works everytime but it adds so much time to the auto-deployment process.

References

Question

I believe that running composer update would fix this problem, but I have no control over the envoyer Install Composer Dependencies section, i can only add pre and post actions. What should I do?

0 likes
1 reply
ejdelmonico's avatar

Envoyer automatically runs composer install so I would make sure that you run a composer require maatwebsite/excel so that the composer.lock file has it. Envoyer is reading from that file if present. If you cannot find a workable solution, I suggest you not tick Deploy When Code Is Pushed in the site settings. That will allow you to correct the issue prior to publishing...which is just a link.

Please or to participate in this conversation.