Alejandro Celaya | Blog

Software development, agile methodologies and open source software.

category Archive — "php"

— 2014 —

Advanced usage of ServiceManager in Zend Framework 2

After a time working with Zend Framework 2 one is used to use the ServiceManager, which is one of the most powerful components in the framework. It eases the creation of objects and performing dependency injection, allowing us to define how objects are created just in one place and letting the Servi…

Unit testing Zend Framework 2 modules

One of the first articles I wrote in this blog was an introduction to unit testing PHP applications. You can find it here in case you need to know the first steps and the theory. On this article I'm going to explain how to get a Zend Framework 2 module tested. It is indeed very similar to test any P…

Managing authentication with Zend\Authentication in PHP projects

Authentication is one of the most usual tasks we need to resolve in medium and large web applications. There are many kinds of authentication. We could use database table authentication, HTTP authentication, LDAP authentication or any other kind of authentication we could imagine. Maybe we need to a…

Migrating from Wordpress to Sculpin

Some time ago, on January 2014, I decided to start writing a blog. Seemed like a good idea. I might be able to show my skills and learn new ones at the same time. I didn't wanted to use a very complex tool for this purpose, or to create one of my own (why to reinvent the wheel?), so I decided that b…

Dependency management and autoloading in php projects with composer

One of the common problems we have to confront when starting a new PHP project is how to handle the different dependencies we are going to have. One could think the easier solution is to download all the libraries we are going to need, put them in a lib directory and add them to the version control …

Create modules with sub-namespaces in Zend Framework 2. Part II

Some weeks ago, I explained how to create modules with sub-namespaces in a Zend Framework 2 application. On that article I created an example module that we could add in our modules directory, but what if we want to distribute that module through the composer network to be installed as a vendor modu…

Create modules with sub-namespaces in Zend Framework 2

The Zend Framework 2 module system is one of its greatest features. You can create re-usable modules very easily. Each module has its own namespace, and each one of them should provide an autoloader implementation for the application to be able to load its classes. The basics Usually we give a name …

How to prepare the Zend Framework 2 Certified Architect exam

Last week I passed the Zend Framework 2 Certified Architect exam. I will try to explain how did I prepare it. Studying In late March I recived an email that my exam was going to be on May the seventh, so I saw that I was going to have 4-6 weeks to prepare it. I could have started earlier, but maybe …

Configure multiple database connections in Doctrine with Zend Framework 2

There are many situations where you need multiple database connections in your application. In this post I am going to explain how to configure a connection to 2 databases to be used by Doctrine in Zend Framework 2 and how to configure a master-slave connection. Both examples will be using MySQL. Le…