Zend Framework 2: performance optimization

Posted on Tags , ,

Nowadays the performance of a website is very very important for everything, user experience, Google and so on.

I have found nice PDF from one PHP conference in 2014 by Gary Hockin, this guy is Zend Framework contributor and made these awesome instructions how to optimize our Zend Framework 2 and how to use best practices.

This is the file Maximising Performance in Zend Framework 2

Some additions from me:

  • Siege – how to measure your performance.
  • Xdebug
  • View template map & Classmaps
    • For this, I have made simple deploy.sh bash script to do several things, one of them is to generate the template map
      #!/usr/bin/env bash
      # Defaults
      # Go to each module folder and execute template_map and classmap generators
      for i in $(ls -d module/*/); do
       # Exclude our base module
       if [ $i == "module/Base/" ]; then
       # Go to module directory
       cd ${i%%/};
       # Generate the template map and class map running PHP scripts
       printf ${GREEN}
       php ../../vendor/zendframework/zendframework/bin/classmap_generator.php -w
       php ../../vendor/zendframework/zendframework/bin/templatemap_generator.php -w
       echo "---"
       printf ${NOCOLOR}
       # Back to Root dir
       cd $projectRootDir;
      # Do your other stuff, run migrations, clear cache, composer update etc.

That’s it, if you have any comments, your own ideas for optimizations or anything else, please write in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.