Category Archives: PHP

Top Books about Zend Framework 3

In this post I want to provide a collection of books on Zend Framework 3 with their brief descriptions, advantages/disadvantages. This list is not yet complete, because ZF3 was released not so long ago, and more books will be released later. I plan to update this list once I discover a new ZF3 book. OK, let’s go!

1. Using Zend Framewrork 3 by Oleg Krivtsov (For beginners, Free)

Using Zend Framework 3 is a free and open-source book about the new version of Zend Framework. This book has a lot of code samples (hosted on GitHub) and is positioned as a book for beginners. Simple things go first in a chapter, which makes it easier to read this book for newbies. This book covers most important ZF3 usage topics like: main ZF3 components, MVC design pattern, what is service manager, how to use forms, how to manage database. This book is closely related with such third-party libraries as Doctrine ORM and Twitter Bootstrap.

2. Web Development with Zend Framework 3 by Michael Romer (A work in progress)

This is a new edition of the Web Development with Zend Framework series by Michael Romer. This book’s goal is to make it easier for you to get started with ZF3. This book is currently a work in progress.



Filed under PHP, Zend Framework 3

A Free Book about Zend Framework

Hi everyone!

I’m pleased to announce that now you can read my new book “Using Zend Framework 3” absolutely for free! Moreover, the book is an open-source project hosted on GitHub, so you are encouraged to contribute. The book source is available by this link.

The “Using Zend Framework 3” book is an adaptation of my previous “Using Zend Framework 2” book.

The new book is designed for beginners. Almost anything is explained in details, and code samples are provided. Samples are stored on GitHub and are available by this link. Each sample is a complete website that you can install on your Apache webserver and see Zend Framework in action.

Hope you’ll enjoy the book!
Oleg Krivtsov


Leave a comment

Filed under PHP, Zend Framework 3

Getting Started with Magento Extension Development – Book Review


Recently, I needed some good resource to start learning Magento e-Commerce system for one of my current web projects. For this project, I was required to write an extension module that would implement a customer-specific payment method. To get started, I tried to browse Magento documentation and to find good free tutorials on the Internet. I was not neither satisfied with the documentation nor could find a good tutorial. After realising that, I decided to find a good book about Magento extension development. I was so lucky, because I’ve found the “Getting Started with Magento Extension Development” book by Branko Ajzele. Below, I provide a brief overview of the book and my personal recommendations.

The Book

Indeed, the “Getting Started with Magento Extension Development” book is the right place to start with Magento extension development! Author’s explanation style is very easy to understand (compared to other resources I’ve faced with). Of course, to read the book you need to be a pro in PHP/Zend Framework development, otherwise you won’t be familiar with the terminology. But, since you know ZF, you will feel comfortable reading this book.

So, the book is some kind of “cook book”, its a set of recipes. Each recipe shows how to write certain example Magento extension from scratch. The complete source code can be downloaded when you purchase the book. The source code is very usable, because when you are new to Magento, you will typically make a mistake/type and will spend many hours determining why the code doesn’t work as you expected. With having the code, you can just install certain extension manually and just see how it works or to investigate its code deeper.

In the beginning of the book, there is a (very large) chapter about Magento code architecture and terminology. You will learn about the directory structure, the code pools (you are targeted on the Community pool), the controllers, actions and routers, the blocks, templates and themes (changeable sets of templates). The terms “controller”, “action” and “route” may be familiar to PHP developers who knows Zend Framework. However, “blocks” and “themes” is a very difficult thing to understand without this excellent book.

Next, you will find several chapters showing step-by-step how to write certain type of extension from scratch. The chapter begins with defining the requiresments for the extension module (What we are trying to achieve?) and the implementation of that requirements (What steps we need to perform to achieve that?)

The author shows how to write different simple types of extensions:

  • Logger extension. Shows how to listen to Magento events and react accordingly.
  • Shipping method extension. Add your own custom shipping method if a standard method doesn’t suits your needs.
  • Payment method extension. Shows how to write a payment method (if a standard one is not suitable for you).

The “Getting Started with Magento Extension Development” book is written by Branko Ajzele. He is a Chief Technology Officer at Inchoo, a Magento Gold Solution partner company that offers top-quality e-commerce solutions, specializing in the Magento e-commerce platform.

The book was published by Packt Publishing. It has 128 pages and costs $17.84. It can be purchased from Packt Publishing web site:

My Recommendations

To those who are new to Magento and strongly wishes to start creating Magento extensions quickly, the “Getting Started with Magento Extension Development” book is the right choice, because the author has a very good explanation style. This book is a set of recipes / very well developed step-by-step tutorials showing how to write modules for Magento. Complete source code can be downloaded together with the book, which makes learning much easier.


Writing review for this book is completely my choice based on my personal interest in learning Magento, and I was not paid for this. I was provided with a free PDF copy of this book in order that I may review it (I cooperate with Packt Publishing from time to time, because I’m interested in learning new things, and they are interested in spreading the word abouth their books). I am not receiving any money reward for writing this review.


Filed under Magento, PHP

When to Create a New Controller in ZF2?

When your site grows in size, you should create new controller classes instead of putting all actions to IndexController. The Index controller is used for defining the actions which work for your entire site. It is recommended to create new controller class for each model (or for most important ones) of your business logic domain.

For example, you can create UserController to manage users of your site. This controller would have the default “index” action for displaying the page with all users, “add” action for adding a new user, “edit” action for editing user’s profile and “delete” action for deleting the user.

By analogy, you would create PurchaseController and its actions to manage the purchases of your products and implementing the shopping cart, DownloadController and its actions to manage file downloads for the site, etc.

Controller Registration

All controller classes belonging to a module should be registered in the module.config.php
configuration file as follows:

return array(
  // ...
  'controllers' => array(
    'invokables' => array(
      'Application\Controller\Index' => 
      // Put other controllers registration here
  // ...

In line 5, we have the the controllers key, which contains the invokables subkey. You should register your controllers here. To register a controller class, you add the line in form of key=>value pair. The key should be the unique ID of the controller, like Application\Controller\Index, and value should be the fully qualified class name of the controller, like Application\Controller\IndexController.

By registering your controller under the invokables subkey, you tell Zend Framework that it can invoke the controller by instantiating it with the new operator. This is the most simple way of instantiating the controller. As an alternative, you can register a factory to create the controller instance, in that case you would register your controller under the factories subkey.

Leave a comment

Filed under PHP, Zend Framework 2

PHPCloud — A New Easy Way to Run ZF2 Web Applications

In this post, I will tell about the PHPCloud, which is a new “platform as a service” which makes it possible to run your Zend Framework 2 based application in the cloud. The PHPCloud is currently in beta testing stage and available for free test usage. I think it is the best time to try it and become familiar with the capabilities provided by the service.

Why to Use PHPCloud?

Today, there are several options available of where you can install and run your Zend Framework 2 based web application:

  1. If your company manages its own server infrastructure and can afford upgrading PHP version to the latest one, you can install ZF2 on your private server.

  2. You can install a ZF2-based web application to a cloud-based hosting service, like Amazon Web Services. Amazon provides Linux server instances as a part of EC2 service. EC2 is rather cheap, and it provides a free usage tier letting you try it for free for one year.

  3. And the third alternative is installing a ZF2-based application is PHP Cloud. This “platform as a service” solution was introduced by Zend Technologies recently. PHP Cloud allows you to develop and install one or several of your web sites in a cloud container.

In this post, I will tell about the third way, which is the easiest one (in my opinion). This way is analogous to Amazon EC2 hosting service, but it automatically provides you with the hardware, operating system, web server and MySQL database, so you can just create a container and start working in a minute. By working, I mean creating an empty ZF2 application, opening it in your web browser and updating the code from your machine.

The difference of the PHPCloud service from Amazon EC2 is that you do not have direct access to the server through SSH terminal. Instead, you will update your code repository throug Git version control system’s client.

Creating a Container

In PHPCloud, web applications are installed to a container. You can imagine the container like a virtual machine with PHP engine installed. One user may have one or more containers. Next I will show how you create a container.

First, you have to log into your Zend account at the page. This is a page which provides access to BETA version of the PHPCloud and is free for test usage.

To log into your account, you need to enter your E-mail and password and click the Log in button (see the figure below for example). If you do not have an account, you will have to register and enter your E-mail address and password.


Once you have logged in, you will see the Welcome page (shown in figure below).


The Welcome page introduces you to the PHPCloud and lists its advantages: you can start coding in a minute and upload your ZF2 application via Git version control system.

Press the Start Now button at the right part of the Welcome page to open the “Create Container” page (shown in figure below):


On the “Create Container” page that appears, you will have to enter the container name (it must be unique among all other container names). Also, you will be asked to enter the container password (you will later use this password for accessing your container with Git client. You can choose a PHP version (5.3 or 5.4) and configure an SMTP server if you want to send E-mails from your web application.

Once you are ready, click the “Create Container” button to trigger the container creation process.

The next page is the “My Containers” page that lists the containers you have already created:

On the “My Containers” page, you can see the container you’ve just created. You can also request to create the second test container, if you wish. In this post, I will use the single container.

The “My Containers” page has the Snapshot, Revert and Delete buttons. The Snapshot button allows you to make a backup copy of the container if you need that. The Revert button is designed to roll back the container to one of its previous states (like you do in a version control system). And, the Delete button allows to remove container.

After creation, your container already has the default web application installed. To see that default application, click the link next to container name (in this example the link is The web page appears like in figure below:


On the page that appears, you can see that the default application is just a stub that offers you to upload some code and start working on your own web site.

Deploying Zend Skeleton Application

Next, I will show how to deploy an empty Zend Skeleton Application in the container we have just created.

On the My Containers page, click the container name link to enter into the container’s Dashboard page (in this example, the container’s name is olegkrivtsov). The Dashboard page appears where you can manage your container (shown in figure below):


On the Dashboard page, open the the PHPCloud->Overview tab. Then click the Deploy New Application link.

In the pop-up window that appears, you need to choose application type (in this example, I choose “Empty Zend Framework 2 Application”). Click the Next button.


On the next page (shown in figure below), choose the application name (in this example, I enter the “skeleton” name).


Here, you will also need to enter the path to the application which is the part of the URL that allows to open your web app in a web browser. In this example, I use the “skeleton” path. As you are ready, click the Deploy New Application button.

Next, you can see you application in the list of installed application on the Dashboard page. Clicking the application name opens it in the web browser (see the figure below):


Alternatively, you can see your installed skeleton application in the web browser by entering the following URL into its address bar: In the URL, the “olegkrivtsov” part is the name of the container, and the “skeleton” is the path to the web application.

Congratulations! We have just deployed our Zend Skeleton Application from scratch and ready to modify its code and develop our own ZF2 based web site.

Using GIT to Update Code in Container

In the last part of this post, I will show how you can connect to your container with the Git client and update the code.

When using Git, you typically make a clone of the code stored in the container, work on it and commit your changes locally, and then push the code back to the container. The Git version control system stores the complete history of the changes you made, so you can roll back your container to any of its previous states. This makes it easy to safely update the code and work on large web applications in a team.

If you don’t have a Git client on your machine yet, I would recommend you to install Tortoise Git that is a convenient graphical Git client for Windows.

To connect to the Git code repository associated with your PHPCloud container, you will need two things: the URL of the repository and a private RSA key.

First, we will obtain the private key. On the Dashboard page, click the Access Keys page. The Access Keys page appears where you can generate a new key pair (see figure below for example).


To do that, in the dropdown list, select the PPK (WinSCP and PuTTY on Windows) option and click the Generate New Keypair button. The PPK private key file then will be downloaded to your machine.

To obtain the Gir repository URL, on the Dashboard page, click the application name (“skeleton” in this example). The popup pane appears (shown in figure below).


On that pane, click the GIT Repository tab. Here you can see two URLs: the first one is the URL for accessing your repository via SSH (recommended), and the second one is for accessing it via HTTPS. You need to copy the first URL.

Next, in Windows Explorer, create an empty directory somewhere and name it, say, “phpcloud”. In Windows explorer, enter the empty directory you have just created and right click on empty space. The context menu appears. Choose the “GIT Clone…” item from the menu. The Git Clone windows appears (shown in figure below).


In the Git window, enter the URL of the repository and pick the PPK file.
Then click the Clone button. The cloning progress window appears:


Once the clone process finishes, you can browse the source code of the skeleton application in Windows explorer (see below for example).


With Tortoise Git, you can make changes, commit them locally and push the changes back to the PHPCloud. In other words, you can work on your web application, apply changes to the code, and see the result in your web browser, the same way you usually do.

1 Comment

Filed under PHP, Zend Framework 2

Becoming a Zend Certified Engineer

This week I watched a webinar “Excellerate your career with Zend Certifications” about Zend Certification. The certification allows to get direct benefits to those who develop web sites with PHP/Zend Framework. Once you have certified, you are able to greatly increase your salary and get a competitive advantage when looking for a new job.

The testing is administered by Pearson VUE centers worldwide. You have 70 questions and 90 minutes to answer them. The goal of the test is to ensure you know the minimum required basics in PHP or Zend Framework. You don’t need to memorize all the PHP documentation (or Zend Framework reference guide), instead, you need to know how code works and what output to expect for certain input. 

Once you submit the answers, you immedieatelly get the results (either you passed the test, or not). As you pass the test, you become a Zend Certified Engineer (ZCE). This title is given for life, and you don’t need to renew it. With the ZCE title, you also get some nice things, such as a “perpetual” copy of Zend Studio IDE, an ability to use the  “Zend Certified Engineer” logo in your CV or resume and a ZCE sticker to put on your laptop 🙂

Leave a comment

Filed under PHP, Zend Framework 2

Get a Cool PHP T-Shirt from Zazzle

I found interesting t-shirts and mugs for people who likes PHP. Those can be purchased from Zazzle (look above for an example).

The link:

Leave a comment

Filed under PHP