Example of caching MVC response using Filesystem cache in ZF2

The code is available on my Github: https://github.com/shenghuahe/zf2-cache-mvc-response Configuration The filesystem cache is configured within Application/module.config.php and therefore delegated to ZendCacheServiceStorageCacheAbstractServiceFactory to construct the Cache Adapter. Response Caching The caching for the MVC response is done through event listeners. This is for separating the concerns and making the code much better decoupled and reusable. Check out […]

Read More »

Create a Zend Framework 2 Module for Composer

I am sure everyone has been using Zend Framework 2 (ZF2) modules created by many others via Packagist, but it can be a little tricky when it comes down to creating your own ZF2 modules to work with Composer, especially when using your own private VCS repository. I found the documentation for setting this up […]

Read More »

Ant returns code 137

I had this problem at work when running php unit tests on Jenkins (CI server) and it took the whole team ages to figure out this problem. I thought it’s something worth sharing. We use Jenkins to run ant which invokes our unit tests and to speed up the process we are running all the […]

Read More »

Debian Zero To Hero Guide (best for PHP developers)

Took me quite a while to pull all these information together. This guide should install most basic packages you will need to get started with PHP Development. *This was tested with Debian 7.1.0 Before we start, please launch a root terminal to save typing a million sudo commands. Short cut key: Alt + F2, search […]

Read More »

Prevent Cross Site Scripting (XSS) attacks from Rich Text Editors

I believe most developers already know the importance of converting / escaping special HTML characters when displaying their content on a Website to prevent XSS attacks.  In PHP, this can be simply done by calling htmlspecialchars([dangerous data]).  However I haven’t seen many articles talking about how to do this when you need to use a […]

Read More »

Ubuntu Zero To Hero Guide (best for PHP developers)

Took me quite a while to pull all these information together. This guide should install most basic packages you will need to get started with PHP Development. *This was tested with Ubuntu 13.04 but most things should also work on Ubuntu 12. Java First #remove open jdk and install oracle jdk sudo apt-get purge openjdk* […]

Read More »

Install PHPUnit

Firstly, run: sudo pear channel-discover pear.symfony.com sudo pear install pear.symfony.com/Yaml Then run: sudo pear channel-discover pear.phpunit.de //this may take a while depending on your internet speed sudo pear install –alldeps pear.phpunit.de/PHPUnit p.s. http://pear.phpunit.de/ is the most up to date official PHPUnit site. If you install it from the default pear package, it will be version 3.4 or 3.5 which […]

Read More »