Over the last couple of years I have written PHP applications using a few different frameworks. I like different aspects of each of them and each has its place, but my default choice when starting something new is Zend Framework 2.
I advocate its use but find other developers have the same problems that I had when first getting started. That is frameworks such as ZF2 assume you already know about namespaces and autoloading, initializers and factories. You already know composer, git and grasp dependency injection.
The world of PHP developers is a broad spectrum and not everyone is familiar with the prerequisites, they just want a way to get started and have explanations of these things as they go along.
Whilst prior knowledge of HTTP requests, OOP, namespaces and design patterns will help with understanding, it is not a prerequisite to following the book.
People already familiar with Zend Framework 2 may learn some things but will not benefit from this book as much as those intending to learn the framework.
The opening chapter is a good introduction to what frameworks are and why you might want to use a framework. Although this chapter focuses on Zend Framework 2, the points made apply to most PHP frameworks and the chapter ends with a comparison of the main alternatives. The comparison is unbiased and leads to the inevitable conclusion that you may as well use ZF2 as it is as they all have pros and cons.
Chapter 2 goes on to explain how to get the skeleton application and get it running on your machine. Given the number of ways to achieve the goal of this chapter, Oleg has done a good job in covering topics that should allow anyone to get started. It may be that readers have their own favorite IDE or web server, which they may use instead but by the end of the chapter all readers will have a working skeleton application running and be in a position to start building something.
Chapter 3 covers namespaces, autoloading and PSR0, the site entry point and how modules are loaded and module entry points. It takes you through the application life cycle and events. Where many other resources make assumptions on developer understanding, this chapter explains concepts in a way that leaves no one behind. If this book had been out in 2012 when I was learning ZF2, chapter 3 would have helped me get up to speed with things that are assumed for learning ZF2.
The book covers MVC in chapter 4, the usual explanation is here but in the context of ZF2. Beyond topics such as controller plugins and view helpers, the chapter again goes further with explaination of what model types you may have in your application and how you can tell a service from an entity and what a factory does for and what a repository is used for. Just like in chapter 3, for those learning these concepts, having these explanations ensures everyone is up to speed without having to have this prerequisite knowledge.
The chapter ends with a good write up of skinny controllers and fat models and provides a guide as to where your code fits into the application.
Chapter 5 covers routing and Chapter 6 covers views in depth, explaining view helpers, partials, layouts and error pages.
Forms can be a cause of pain, so it is good to see Chapter 7 is all about forms and the chapter starts with HTML forms and builds up piece by piece to arrive at building a complete form using compoenets provided by ZF2. Chapter 8 is short and covers captchas and CSRF and discusses briefly how to add these elements to Zend forms.
For anyone with an understanding of PHP wanting to learn modern frameworks and Zend Framework 2 in particular, this book explains what you need to know to start building websites using this framework. More than that it will teach you the concepts and prerequisites. Many of which apply equally to working with other PHP frameworks. This will likely improve your overall understanding of modern PHP.
There are a few notable topics that aren't covered in the book. The book focuses on building websites with Zend Framework and one of the first things I find that all wesites need after the initial views are built, is navigation. Seeing a chapter on Zend\Navigation, covering menus, sitemaps and RSS feeds would be a welcomed addition and would fit in perfectly after the chapter on views.
The other thing I feel is missing is how to work with databases. Many people learning a framework such as Zend Framework 2 are doing so because they are building applications that are more than a static website and working with databases becomes an important part of those projects.
While "Using Zend Framework 2" is still a work in progress, it is already a great resource for those unfamilar with the framework. It does a great job of including the information that other resources leave out. Many people struggle to get into Zend Framework 2 but this book does a good job of taking you over that initial steep learning curve and providing enough information to get you started on building websites.
I was asked by the author, Oleg Krivtsov, to review this book and was delighted to be asked. I was provided with a free PDF copy of this book in order that I may review it. I am not receiving any reward for writing this review and the views here are my own.