solvit.io

Improve Composer performance in production servers

Solution

Execute this command in the production servers to generate the entire PHP autoload configuration in advance (you can get a performance improvement of up to 15%):

$ composer dump-autoload --optimize --no-dev --classmap-authoritative

Command options:

  • --optimize resolves the location of every PSR-0 and PSR-4 compatible PHP class and creates a "class map" so they don't have to be resolved at runtime.
  • --no-dev removes all the classes that are only used in the development servers (e.g. tests).
  • --classmap-authoritative prevents Composer from scanning the file system for classes that are not found in the class map.
Find more solutions about: , ,