Q: I only have access to production via FTP. Is there an option how to install vendor packages via Composer for production?
A: Yes, you can install vendor packages via Composer for production, but it's not recommended to do it directly on the production server, especially if you only have FTP access. The recommended way is to do it locally or in a CI/CD pipeline, and then upload the vendor directory along with your application code to the production server.
Here are the steps:
- Run
composer install --no-dev --optimize-autoloaderon your local machine or in your CI/CD pipeline. This command will install only the packages required for production and optimize the autoloader for better performance. - Upload the entire application, including the
vendordirectory, to your production server using FTP.
If you absolutely must run Composer directly on your production server and you have SSH access, you can run the composer install --no-dev --optimize-autoloader command directly on the server. However,