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.
Main Concepts
Code Blueprint
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.
Virtual Machine
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.


7 Responses to "Getting Started!"
Hi Michael,
very interesting project!
I was looking for a ZF project skeleton with doctrine and Symfony DIC integration and ended here. One idea for the wishlist: I would prefer a version without the VM for a couple of reasons, is it possible to split the project:
a) small version without VM
b) large version with VM
(I am aware that it will be more difficult for boilerplate users to make sure that everything is set up correctly for the small version).
Viele Gruesse
Dorthe
Hi Dorthe -
thanks much for your feedback. Please check the FAQ page I just set up regarding the VM: http://zf-boilerplate.com/faq/ . I am also currently working on ZF-Initilizr that will make ZF-Boilerplate a lot more configurable. It will allow you to pick the tools and libraries you want to have included in your customized ZF-Boilerplate distribution. However, getting this off the ground will take some more time …
Cheers!
Michael
Awesome work! This is exactly the type of project that the PHP community needs. I have always found it to be a pain trying to set up a PHP development environment. Good thing we have Ruby developers making it easier for us PHP developers
At work we’re also running a vagrant environment, but with name based virtual hosts and forwarding ports 80/443 so you can pull it up in the host’s browser like normal. Keep up the good work!
Hello Michael!
This is a very nice idea!
Just something that shocked me a bit:
Why do you discourage to use ZF-B when refactoring a Project?
Or using it in an already developed project to enhance it?
I hope it’s just you don’t know of the side effects and doesn’t want to be the support for occuring problems when doing that.
BG
Barry
Hi Barry -
thanks for your feedback. Indeed, there is no real reason to better not use ZF-Boilerplate for existing projects. In fact, it’s perfectly fine to pull in ZF-Boilerplate later in the process. So, actually, I don’t know why I said this
However, I still believe, ZF-Boilerplate is best used on a “green field” situation, while also being a good improvement option for existing projects.
Thanks again for posting and using & supporting ZF-Boilerplate!
Michael
Hey, can you help me please? I’m trying to zf-Boilerplate on Windows Apache+php5.3 (Zend Server exactly), but it tells me that memcashe not found:
Fatal error: Class ‘Memcache’ not found in C:\Program Files (x86)\Zend\Apache2\htdocs\zfboilerprint\library\Bisna\Application\Container\DoctrineContainer.php on line 460
I don’t know which memcashe does zf-Boilerplate require “memcashe”, “memcashed” or some another, I never worked with Doctrine, I’m new to Zend Framework honestly, and not really sure if I’ll manage to configure it, but ask for your help.
Kusma: Basically there is two versions of memory cache (memcache and mencached) I’ve played with both in linux whith no result. My workaround is to disable memcahe in configuration.ini commenting out the relevant line.