• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Foundations of Zend Framework_2
 

Foundations of Zend Framework_2

on

  • 1,163 views

For this talk Adam Culp will cover a basic intro to Zend Framework 2 (ZF2) and how to use the foundational pieces. We will discover how to get a Zend Framework 2 application up and running quickly ...

For this talk Adam Culp will cover a basic intro to Zend Framework 2 (ZF2) and how to use the foundational pieces. We will discover how to get a Zend Framework 2 application up and running quickly using GitHub, Composer, and the Zend Framework 2 Skeleton Application. Then we will leverage the Zend Skeleton Module to introduce adding modules to a Zend Framework 2 application.

We will also cover basic usage of the ZF2 module manager, event manager, service manager, and database components. Adam will also introduce some useful resources to help attendees continue learning on their own. The goal of the talk is to give attendees enough information to be able to get a jump start into using ZF2.

Statistics

Views

Total Views
1,163
Views on SlideShare
1,163
Embed Views
0

Actions

Likes
1
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Foundations of Zend Framework_2 Foundations of Zend Framework_2 Presentation Transcript

    • Foundations of Zend Framework 2 By: Adam Culp Twitter: @adamculp https://joind.in/10393
    • Foundations of Zend Framework 2  About me  PHP 5.3 Certified  Consultant at Zend Technologies  Organizer SoFloPHP (South Florida)  Organizer SunshinePHP (Miami)  Long Distance (ultra) Runner  Judo Black Belt Instructor
    • Foundations of Zend Framework 2  Base Info  PHP >= 5.3.3  Open source   On GitHub Diverse install methods    Pyrus, Composer, Git Submodules Details at: http://framework.zend.com/downloads Built on MVC design pattern
    • Foundations of Zend Framework 2  Get Started  http://framework.zend.com
    • Foundations of Zend Framework 2  M = Model  Model = Business Logic, Data  Models  Database  Entities  Services
    • Foundations of Zend Framework 2  V = View  View = GUI, Presentation, Visual Representation  HTML  CSS  Javascript  JSON  XML
    • Foundations of Zend Framework 2  C = Controller  Controller = Link between a user and the system. Traffic director.  Places calls to Model layer.  Passes needed info to the View layer.
    • Foundations of Zend Framework 2  Easy Setup  Git clone Zendframework Skeleton Application   Update Composer   Github /zendframework/ZendSkeletonApplication php composer.phar self-update Install Zend Framework 2  php composer.phar install    Creates/Populates /vendor directory Clones Zend Framework 2 Sets up Composer autoloader (PSR-0 compliant)
    • Foundations of Zend Framework 2  Base Structure of Zend Framework Skeleton  NO MAGIC!!!  Configuration driven   Passed in configuration array OR Passed via method calls from Module.php  No dictated structure  Uses namespaces
    • Foundations of Zend Framework 2  Typical Application Flow - Load  Index.php  calls autoloader (PSR-0 = default)  init Application with application.config.php
    • Foundations of Zend Framework 2  Typical Application Flow – App Config  Application.config.php    Loads modules one at a time (Module.php = convention) Specifies where to find modules Loads configs in autoload directory (DB setings, etc.)
    • Foundations of Zend Framework 2  Modules  Related code and assets for a specific problem.  Easy creation using Zend Skeleton Module   GitHub /zendframework/ZendSkeletonModule Logical separation of application functionality  Reusable  Removing a module doesn't kill the application  By convention modules are found in:    Modules directory Vendor directory Contains everything specific to given module
    • Foundations of Zend Framework 2  Typical Application Flow – Modules  Module.php (convention)  Makes MvcEvent accessible via onBootstrap()  Giving further access to Application, Event Manager, and Service Manager.  Loads module.config.php  Specifies autoloader and location of files.  May carry services and event as needed.
    • Foundations of Zend Framework 2  Typical Application Flow – Module Config  Module.config.php  Containers are module specific        Routes Navigation Service Manager Translator Controllers View Manager Steer clear of Closures (Anonymous Functions)  Do not cache well within array.
    • Foundations of Zend Framework 2  Routes  Carries how controller maps to request  Types:  Hostname – 'me.adamculp.com'  Literal - '/home'  Method – 'post,put'  Part – creates a tree of possible routes  Regex – use regex to match url '/blog/?<id>[0-9]?'  Scheme – 'https'  Segment - '/:controller[/:action][/]'  Query – specify and capture query string params
    • Foundations of Zend Framework 2  Navigation (optional)  Used for menu and/or sitemap representation  Define config array in module.config.php  Add navigation factory to service manager  Output using HTML helper  Can define additional items per module
    • Foundations of Zend Framework 2  Database  3 different ways to interact with data:  DB  Select  Table Gateway  Define adapter in global config  DB credentials should be put in db.local.php  NEVER added to source control
    • Foundations of Zend Framework 2  Services  Replacement for DI  Can be created from:   Module classes  Module configuration   Application configuration Local override configuration Controllers are services
    • Foundations of Zend Framework 2  Services  Types:  Explicit (name => object pairs)  Invokables (name => class to instantiate)  Factories (name => callable returning object)  Aliases (name => some other name)  Abstract Factories (unknown services)  Scoped Containers (limit what can be created)  Shared (or not; you decide)
    • Foundations of Zend Framework 2  Event Manager  Triggers events  Listen and react to triggered events  Object that Aggregates listeners  Listener is a callback that can react to an event  Event is an action
    • Foundations of Zend Framework 2  Events  Everything is an event  Loading Modules  Bootstrap  Route  Dispatch  Dispatch.error  Render  Finish
    • Foundations of Zend Framework 2  Diagram of MVC Events
    • Foundations of Zend Framework 2  REST  AbstractRestfulController  Outputs JSON  View not needed  Contains methods to handle get, post, put, delete
    • Foundations of Zend Framework 2  Resources      http://framework.zend.com http://www.zend.com/en/services/training/course-catal og/zend-framework-2 http://www.zend.com/en/services/training/course-cata log/zend-framework-2-advanced http://zendframework2.de/cheat-sheet.html Code - https://github.com/adamculp/foundations-zf2-talk
    • Foundations of Zend Framework 2  Thank You!  Speaker: Adam Culp  Twitter: @adamculp  Rate this talk: https://joind.in/10393  Code: https://github.com/adamculp/foundations-zf2-talk