What is ZF-Boilerplate?
ZF-Boilerplate is a code blueprint for enterprise-grade PHP applications and a virtual development environment. It combines the most popular code libraries such as Zend Framework, Doctrine 2 and Symfony Components and ships with all the glue code to make the libraries work together seamlessly. ZF-Boilerplate also is a virtual development environment. It allows you to spin-up a virtual machine that runs the code you developed on a workstation of your choice. In fact, it lets you write your code on a barebone workstation (e.g. Windows) with only the IDE of your choice being installed and allows you to run it on a fully configured production-like server environment in a virtual machine right on your local box. You will learn more about why this is a good idea and how this actually works in the next sections.
Why should I use ZF-Boilerplate?
In short, if you want to dramatically speed up your development time for a new Zend Framework based application you will want to base your application on ZF-Boilerplate instead of building from scratch. As enterprise applications have very different requirements compared to a hobby project, bootstrapping a new application takes a long time. You will at least need to:
- Set up every single workstation for developing and running the code. This is installing the LAMP stack, PEAR and PECL modules, additional server applications, configuring Apache und so forth. Its getting even worse when you want to support multiple operating systems.
- Download all the libraries and frameworks needed.
- Set up the initial code structure for your application and write alll the glue code to make the piece work together. Debug. Try again. Debug and try agin. Debug …
- Install and configure all the tools for testing, documenting and profiling you application and its source code.
- Write several helper scripts for code deployments, code style checks, test suites etc. etc. etc.
- (your typical bootstrapping task goes here …)
All this work mainly has already been done with ZF-Boilerplate. You favourite bootstrapping task will probably be covered as well. Using ZF-Boilerplate as a starting point for your applicaion will save you and your team hours, days or weeks of frustrating bootstrapping work. It allows you to focus on solving your specific business problem right from the beginning. Even the most experienced and most agile Scrum-Teams out there usually will need to spend 2-3 Sprints and several weeks of work for putting the application and development foundation in place. With ZF-Boilerplate, this work is done in less than 30 minutes. Guaranteed.
You will want to download the latest and greatest version of ZF-Boilerplate for your next Zend Framework based project. When doing so, you take ZF-Boilerplate’s codebase to go from there. So you essentially fork ZF-Boilerplate and develop it further towards your custom solution. You will not want to pull ZF-Boilerplate into existing applications, however, you can in general.
You have different options to initially get the ZF-Boilerplate code: Simply downloading it a as zipped package to your workstation will work. Optionally can put it under version control by yourself. As well you can clone/fork the ZF-Boilerplate git repository on github. Choose the approach of your choice. All will work. Once you have the code available, you will need to do some setup on your box to bring a virtual machine to live. But first, learn more about the idea of the Virtual Machine in the next section.
ZF-Boilerplate does not only include the actually bootstrapping code for your custom application, but also some metacode that is used to automatically create a virtual development environment based on VirtualBox. Essentially, the metacode creates a fully-configured Ubuntu Linux LAMP-Server that can be accessed from the host system, the workstation where the actually application code is made available, either using in the browser (default is: http://localhost:8080) or via SSH. While you stay on your workstation (the host system) to develop your code, it being served from the Virtual Machine (the runtime environment).
The idea behind that is simple but powerful. First of all, you don’t need to set up a full runtime environment on you local workstation. You only need to set up the tools for creating and running the Virtual Machine once on your workstation and then can create as many specific runtime environments as you need for your projects. This especially is very handy, if you. Furthermore, this approach allow you to develop in an environment that is as identically. If you prefer Windows or Mac on your workstation but run Linux in production, this is a major advantage. You will … siginificantly less surprises when deploying your app in the final runtime environment.
With ZF-Boilerplate, the virtual runtime environment is fully configured using code. You programatically define the applications and tools on the virtual machine and can build it scratch with a single command. You can also apply a modified configuration in seconds. You want to use another version of PHP? Just change the concerning VM configuration files and do the provising. Done.
All the tools
So, now you have the code and your development environment. This actually is only where the fun begins! ZF-Boilerplate ships with all the tools which really make the difference in an enterprise environment: PHPUnit, XDebug, PHP_MD, PHP_LOC, PHP_Depend, PHP_Codesniffer and the list goes on and on and on. And the best: It’s works all out-of-the-box with additional helper scripts that make using the tools a piece of a cake.
… more then the sum of its parts!
You will quickly realize that ZF-Boilerplate effectively is way more then the sum of its parts. It’s total new and exciting way to build applications using PHP and Zend Framework, a platform for rapid development of high-class applications for the enterprise. ZF-Boilerplate not only brings you all the tools you should use to produce high quality code, it also finally makes them easy to use. Soon you will question how you could ever develop without. ZF-Boilerplate establishes code structures and conventions that go far beyond what is given by the Zend Framework alone, leading to quicker development and easier on-ramping of new team members. In short, ZF-Boilerplate is the new way of building enterprise PHP applications. You should now head over to the Installation Guide to keep going.