Skip to content

Instantly share code, notes, and snippets.

@attitude
Created March 21, 2024 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attitude/ab4f2ae438734822679d1d791fa9df93 to your computer and use it in GitHub Desktop.
Save attitude/ab4f2ae438734822679d1d791fa9df93 to your computer and use it in GitHub Desktop.
Installing Composer for production

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:

  1. Run composer install --no-dev --optimize-autoloader on 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.
  2. Upload the entire application, including the vendor directory, 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, this is not recommended because it can lead to downtime and other issues if something goes wrong during the installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment