Zend Framework 2 Akrabat Tutorial
Install zf2 skeleton app Git Tag: zf-tutorial
curl -s https://getcomposer.org/installer | php
php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application path/to/install
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /path/to/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /path/to/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Wait! Make sure that you zf2-tutorial.localhost is mapped to 127.0.0.1
You can follow this tutorial here: http://zf2.readthedocs.org/en/latest/user-guide/overview.html
- Create the Module class for the Album module
- Create the autoload_classmap file
- Create the module.config file
- Update the application config file
- Add the routes for the specific controller & actions
- Create the controller
- Create the database and the tables
- Create the entity models
- Crete the TableGateway classes
- Configure Service Manager
- Configure the connection with the db (global parameters and local parameters)
- Add lang strings
- Modify app layout
- Create forms
- Add the filter and validators to the entity model
- Call form from controllerer's actions
- Render forms in views
- Force to show list in app index
Testing with phpunit Git Tag: zf-tutorial-phpunit
Follow the steps in this tutorial: http://zf2.readthedocs.org/en/latest/tutorials/unittesting.html
- Setting up the tests directory
- Bootstrapping your tests
- Your first Controller test
- A failing test case
- Configuring the service manager for the tests
- Testing actions with POST
- Testing model entities
- Testing model tables
Working with Doctrine2 Git Tag: zf-tutorial-Doctrine2
To work with doctrine2 in this tutorial I followeed this:
- Jason Grimes tutorial: http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/
- Marco Pivetta slides: http://marco-pivetta.com/doctrine-orm-zf2-tutorial/
- To verify, this bitbucket repo: https://bitbucket.org/anjheu/zf2_doctrine2
- Install Doctrine modules
- Create the Album entity
- Update the Album controller to use Doctrine instead of Zend_Db
- Install zendframework-developer-tools
Adding Navigation Branch navigation
Follow this tutorial: http://zf2.readthedocs.org/en/latest/tutorials/tutorial.navigation.html
- Preparation
- Setting Up Zend\Navigation
- Configuring our Site Map
- Adding the Menu View Helper
- Adding Breadcrumbs
Add a Contact Form Branch contactForm
Add a contact form to the zf2-tutorial using the PhlyContact module. To install and configure it, follow this tutorial: http://www.mwop.net/blog/2012-09-19-zf2-module-screencast.html
Add a Static Page Branch staticPages
Add the PhlySimplePage module to add static pages to our application. Follow the steps of the Readme to use it.