Skip to content

danigonza/zf2-tutorial

Repository files navigation

zf2-tutorial

Build Status

Zend Framework 2 Akrabat Tutorial

Install zf2 skeleton app Git Tag: zf-tutorial

Download composer

curl -s https://getcomposer.org/installer | php

Download ZF2 Application Skeleton

php composer.phar create-project --repository-url="https://packages.zendframework.com" zendframework/skeleton-application path/to/install

VirtualHost


<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

Tutorial

You can follow this tutorial here: https://zf2.readthedocs.org/en/latest/user-guide/overview.html

Album Module

  1. Create the Module class for the Album module
  2. Create the autoload_classmap file
  3. Create the module.config file
  4. Update the application config file

Routing and controllers

  1. Add the routes for the specific controller & actions
  2. Create the controller

Database and models

  1. Create the database and the tables
  2. Create the entity models
  3. Crete the TableGateway classes
  4. Configure Service Manager
  5. Configure the connection with the db (global parameters and local parameters)

Styling and Translations

  1. Add lang strings
  2. Modify app layout

Forms and actions

  1. Create forms
  2. Add the filter and validators to the entity model
  3. Call form from controllerer's actions
  4. Render forms in views
  5. Force to show list in app index

Testing with phpunit Git Tag: zf-tutorial-phpunit

Follow the steps in this tutorial: https://zf2.readthedocs.org/en/latest/tutorials/unittesting.html

  1. Setting up the tests directory
  2. Bootstrapping your tests
  3. Your first Controller test
  4. A failing test case
  5. Configuring the service manager for the tests
  6. Testing actions with POST
  7. Testing model entities
  8. Testing model tables

Working with Doctrine2 Git Tag: zf-tutorial-Doctrine2

To work with doctrine2 in this tutorial I followeed this:

  1. Install Doctrine modules
  2. Create the Album entity
  3. Update the Album controller to use Doctrine instead of Zend_Db
  4. Install zendframework-developer-tools

Adding Navigation Branch navigation

Follow this tutorial: https://zf2.readthedocs.org/en/latest/tutorials/tutorial.navigation.html

  1. Preparation
  2. Setting Up Zend\Navigation
  3. Configuring our Site Map
  4. Adding the Menu View Helper
  5. 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: https://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.

About

Zend Framework 2 Akrabat Tutorial

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages