Image for post: Zend framework 2 performance

Zend framework 2 performance

Even on localhost, if you look at the zend developer toolbar, you will see that the loading page time will be decreased after doing these actions. They are simple but there aren't so much explanations and documentations on the web.

Generate template map

Your application will load the map for each module. Go to your module directory (for example: cd module\Application) and launch this command:

php ../../vendor/zendframework/zendframework/bin/templatemap_generator.php

The file list will appear in module\Application\template_map.php. Do the same with all the other modules you have.

Generate autoload class map

Autoload classmap will be generated in module\Application\autoload_classmap.php. You have to use the classmap_generator:

cd vendor\binclassmap_generator.php.bat -l "..\..\module\Application"

or run classmap_generator.php if you are using Linux.

 Other Tips

Just to remember some hints as a checklist:

  • Use cache but dont' abuse it
  • Controllers: try to keep controller methods as short and clean as you can. Use design patterns implementation and unit test to write and refactor the code
  • If you are adding something in a Module.php.