SlideShare uma empresa Scribd logo
1 de 45
Foundations of Zend Framework 2
By:
Adam Culp
Twitter: @adamculp
https://joind.in/14923
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
 What is...
 Uses PHP >= 5.5
 Open Source
 On GitHub
 Diverse Install
 Pyrus, Composer, Git Submodules
 Built on MVC design pattern
 Can be used as components or entire framework
Foundations of Zend Framework 2
 Skeleton Application
 Git clone Zendframework Skeleton Application
 Github /zendframework/ZendSkeletonApplication
Foundations of Zend Framework 2
 Composer
 Update Composer
 php composer.phar self-update
 Install Zend Framework 2
 php composer.phar install
 Creates and/or populates '/vendor' directory
 Clones Zend Framework 2
 Sets up Composer autoloader (PSR-0)
Foundations of Zend Framework 2
 Composer (easiest)
 Update Composer
 php composer.phar self-update
 Create Project
 php composer create-project
zendframework/skeleton-application
Foundations of Zend Framework 2
 Structure
Foundations of Zend Framework 2
 Zend Framework 2 Usage
 NO MAGIC!!!
 Configuration driven
 No forced structure
 Uses namespaces
Foundations of Zend Framework 2
 MVC
 Very briefly
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
 NO BUSINESS LOGIC!
Foundations of Zend Framework 2
 C = Controller
 Controller = Link between a user and the system.
 Places calls to Model layer.
 Passes needed info to the View layer.
Foundations of Zend Framework 2
 Typical Application Flow - Load
 index.php
 Loads autoloader (PSR-0 = default)
 init Application using 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 settings,
etc.)
Foundations of Zend Framework 2
 Modules
 Related for a specific “problem”.
 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
 Module
 Contents
 PHP Code
 MVC Functionality
 Library Code
 Though better in Application or via Composer
 May not be related to MVC
 View scripts
 Public assets (images, css, javascript)
 More?
Foundations of Zend Framework 2
 Modules
 Easy creation using Zend Skeleton Module
 GitHub /zendframework/ZendSkeletonModule
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 define services and wire event listeners as
needed.
Foundations of Zend Framework 2
 Typical Application Flow – Module Config
 module.config.php
 Containers are component specific
 Routes
 Navigation
 Service Manager
 Translator
 Controllers
 View Manager
 Steer clear of Closures (Anonymous Functions)
 Do not cache well within array.
 Less performant (parsed and compiled on every req)
as a factory only parsed when service is used.
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
 Route Example
/module/Application/config/module.config.php
Foundations of Zend Framework 2
 Navigation and Sitemaps (optional)
 Driven by configuration.
/module/Application/config/module.config.php
Foundations of Zend Framework 2
 Navigation and Sitemaps (optional)
 Use in Layout or View.
/module/Application/view/layout/layout.phtml
Foundations of Zend Framework 2
 Database
 3 different ways to interact with data:
 DB
 Select
 Table Gateway
 Or use an ORM of your choosing
Foundations of Zend Framework 2
 Services
 ALL THE THINGS!
Foundations of Zend Framework 2
 ServiceManager
 Recommended alternative to ZendDi
 Di pure DIC, SM is factory-based container (no
magic, code explicitly details how instance created)
 Can be created from:
 Application configuration
 Module classes
 Module configuration
 Local override configuration
 Everything is a service, even Controllers (though
provided by ControllerManager)
Foundations of Zend Framework 2
 Service Sample
/module/Application/config/module.config.php
Foundations of Zend Framework 2
 Service Usage
/module/Application/Module.php
/module/Application/view/layout/layout.phtml
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
 Diagram of MVC Events
Foundations of Zend Framework 2
 Events
 Everything is an event
 loadModule(s)
 .resolve, .post
 bootstrap
 route
 dispatch
 dispatch.error
 render
 render.error
 finish
 sendResponse
Foundations of Zend Framework 2
 Event Sample
/module/Application/Module.php
Foundations of Zend Framework 2
 Views
 Directory Structure
Foundations of Zend Framework 2
 Views
 View Model
 Array carrying info to the view.
 Automatically created, unless created specifically.
 Hold Variable Containers for use in the View.
/module/Application/Module.php
/module/Application/view/layout/layout.phtml
Foundations of Zend Framework 2
 Forms Sample
 Create elements
/module/Products/src/Products/Form/ProductSearchForm.php
Foundations of Zend Framework 2
 Forms Sample
 Pass the form to view
/module/Products/src/Products/Controller/ProductsController.php
Foundations of Zend Framework 2
 Forms Sample
 Output form in view
/module/Products/view/products/products/search.phtml
Foundations of Zend Framework 2
 REST
 AbstractRestfulController
 Parsing JSON request bodies
 View not needed (with Json View Strategy)
 Contains methods to handle get, post, put, delete
 Extend as needed
Foundations of Zend Framework 2
 REST Sample
 Create Route
/module/ProductsRest/config/module.config.php
Foundations of Zend Framework 2
 REST Sample
 Apply Json View Strategy
/module/ProductsRest/config/module.config.php
Foundations of Zend Framework 2
 REST Sample
 Create result as JsonModel
 No view files needed, outputs JSON
/module/ProductsRest/src/Controller/ProductsController.php
Foundations of Zend Framework 2
 Apigility.org
 Ensures well-formed API
 Dev does less work
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
 http://apigility.org
Foundations of Zend Framework 2
 Thank You!
 Rate this talk: https://joind.in/14923
 Code: https://github.com/adamculp/foundations-zf2-talk
Adam Culp
http://www.geekyboy.com
http://RunGeekRadio.com
Twitter @adamculp

Mais conteúdo relacionado

Mais procurados

ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)ZFConf Conference
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf Conference
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf Conference
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Stefano Valle
 
Using Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonUsing Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonJeremy Brown
 
WordPress and Zend Framework Integration with Vulnero
WordPress and Zend Framework Integration with VulneroWordPress and Zend Framework Integration with Vulnero
WordPress and Zend Framework Integration with VulneroAndrew Kandels
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)James Titcumb
 
Cryptography with Zend Framework
Cryptography with Zend FrameworkCryptography with Zend Framework
Cryptography with Zend FrameworkEnrico Zimuel
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...King Foo
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)James Titcumb
 
20120722 word press
20120722 word press20120722 word press
20120722 word pressSeungmin Sun
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
 
Authentication with zend framework
Authentication with zend frameworkAuthentication with zend framework
Authentication with zend frameworkGeorge Mihailov
 
Make your application expressive
Make your application expressiveMake your application expressive
Make your application expressiveChristian Varela
 
Browser Serving Your We Application Security - ZendCon 2017
Browser Serving Your We Application Security - ZendCon 2017Browser Serving Your We Application Security - ZendCon 2017
Browser Serving Your We Application Security - ZendCon 2017Philippe Gamache
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot WorldSchalk Cronjé
 

Mais procurados (19)

ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2
 
Using Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's SkeletonUsing Zend_Tool to Establish Your Project's Skeleton
Using Zend_Tool to Establish Your Project's Skeleton
 
WordPress and Zend Framework Integration with Vulnero
WordPress and Zend Framework Integration with VulneroWordPress and Zend Framework Integration with Vulnero
WordPress and Zend Framework Integration with Vulnero
 
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
 
Cryptography with Zend Framework
Cryptography with Zend FrameworkCryptography with Zend Framework
Cryptography with Zend Framework
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
 
20120722 word press
20120722 word press20120722 word press
20120722 word press
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
Authentication with zend framework
Authentication with zend frameworkAuthentication with zend framework
Authentication with zend framework
 
Make your application expressive
Make your application expressiveMake your application expressive
Make your application expressive
 
Browser Serving Your We Application Security - ZendCon 2017
Browser Serving Your We Application Security - ZendCon 2017Browser Serving Your We Application Security - ZendCon 2017
Browser Serving Your We Application Security - ZendCon 2017
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot World
 

Destaque

IPC 2015 Zend Framework 3 Reloaded
IPC 2015 Zend Framework 3 ReloadedIPC 2015 Zend Framework 3 Reloaded
IPC 2015 Zend Framework 3 ReloadedRalf Eggert
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend FrameworkAdam Culp
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloadedRalf Eggert
 
Easily extend your existing php app with an api
Easily extend your existing php app with an apiEasily extend your existing php app with an api
Easily extend your existing php app with an apiMichelangelo van Dam
 
PHPunconf14: Apigility Einführung
PHPunconf14: Apigility EinführungPHPunconf14: Apigility Einführung
PHPunconf14: Apigility EinführungRalf Eggert
 
Decouple your framework now, thank me later
Decouple your framework now, thank me laterDecouple your framework now, thank me later
Decouple your framework now, thank me laterMichelangelo van Dam
 

Destaque (8)

IPC 2015 Zend Framework 3 Reloaded
IPC 2015 Zend Framework 3 ReloadedIPC 2015 Zend Framework 3 Reloaded
IPC 2015 Zend Framework 3 Reloaded
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
Apigility reloaded
Apigility reloadedApigility reloaded
Apigility reloaded
 
Easily extend your existing php app with an api
Easily extend your existing php app with an apiEasily extend your existing php app with an api
Easily extend your existing php app with an api
 
PHPunconf14: Apigility Einführung
PHPunconf14: Apigility EinführungPHPunconf14: Apigility Einführung
PHPunconf14: Apigility Einführung
 
Decouple your framework now, thank me later
Decouple your framework now, thank me laterDecouple your framework now, thank me later
Decouple your framework now, thank me later
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Semelhante a Deprecated: Foundations of Zend Framework 2

ZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityJohn Coggeshall
 
Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2John Coggeshall
 
Symfony2 for Midgard Developers
Symfony2 for Midgard DevelopersSymfony2 for Midgard Developers
Symfony2 for Midgard DevelopersHenri Bergius
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015David Alger
 
SeedStack feature tour
SeedStack feature tourSeedStack feature tour
SeedStack feature tourSeedStack
 
JavaScript Modules in Practice
JavaScript Modules in PracticeJavaScript Modules in Practice
JavaScript Modules in PracticeMaghdebura
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolGordon Forsythe
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughBradley Holt
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Creating your own framework on top of Symfony2 Components
Creating your own framework on top of Symfony2 ComponentsCreating your own framework on top of Symfony2 Components
Creating your own framework on top of Symfony2 ComponentsDeepak Chandani
 
Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Michelangelo van Dam
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBo-Yi Wu
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Fwdays
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework FoundationsChuck Reeves
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your projectMichelangelo van Dam
 

Semelhante a Deprecated: Foundations of Zend Framework 2 (20)

ZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularityZF2 Modules: Events, Services, and of course, modularity
ZF2 Modules: Events, Services, and of course, modularity
 
Introduction to Zend Framework 2
Introduction to Zend Framework 2Introduction to Zend Framework 2
Introduction to Zend Framework 2
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
 
Symfony2 for Midgard Developers
Symfony2 for Midgard DevelopersSymfony2 for Midgard Developers
Symfony2 for Midgard Developers
 
Zend
ZendZend
Zend
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015
 
TomatoCMS in A Nutshell
TomatoCMS in A NutshellTomatoCMS in A Nutshell
TomatoCMS in A Nutshell
 
SeedStack feature tour
SeedStack feature tourSeedStack feature tour
SeedStack feature tour
 
JavaScript Modules in Practice
JavaScript Modules in PracticeJavaScript Modules in Practice
JavaScript Modules in Practice
 
Zf2 phpquebec
Zf2 phpquebecZf2 phpquebec
Zf2 phpquebec
 
Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Creating your own framework on top of Symfony2 Components
Creating your own framework on top of Symfony2 ComponentsCreating your own framework on top of Symfony2 Components
Creating your own framework on top of Symfony2 Components
 
Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
 

Mais de Adam Culp

Putting legacy to REST with middleware
Putting legacy to REST with middlewarePutting legacy to REST with middleware
Putting legacy to REST with middlewareAdam Culp
 
Release your refactoring superpower
Release your refactoring superpowerRelease your refactoring superpower
Release your refactoring superpowerAdam Culp
 
Managing Technical Debt
Managing Technical DebtManaging Technical Debt
Managing Technical DebtAdam Culp
 
Developing PHP Applications Faster
Developing PHP Applications FasterDeveloping PHP Applications Faster
Developing PHP Applications FasterAdam Culp
 
Containing Quality
Containing QualityContaining Quality
Containing QualityAdam Culp
 
Debugging elephpants
Debugging elephpantsDebugging elephpants
Debugging elephpantsAdam Culp
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshopAdam Culp
 
Expressive Microservice Framework Blastoff
Expressive Microservice Framework BlastoffExpressive Microservice Framework Blastoff
Expressive Microservice Framework BlastoffAdam Culp
 
Accidental professional
Accidental professionalAccidental professional
Accidental professionalAdam Culp
 
Build great products
Build great productsBuild great products
Build great productsAdam Culp
 
Does Your Code Measure Up?
Does Your Code Measure Up?Does Your Code Measure Up?
Does Your Code Measure Up?Adam Culp
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsAdam Culp
 
Virtualizing Development
Virtualizing DevelopmentVirtualizing Development
Virtualizing DevelopmentAdam Culp
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy CodeAdam Culp
 
Clean application development tutorial
Clean application development tutorialClean application development tutorial
Clean application development tutorialAdam Culp
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101Adam Culp
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developersAdam Culp
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized DevelopmentAdam Culp
 

Mais de Adam Culp (20)

Hypermedia
HypermediaHypermedia
Hypermedia
 
Putting legacy to REST with middleware
Putting legacy to REST with middlewarePutting legacy to REST with middleware
Putting legacy to REST with middleware
 
php-1701-a
php-1701-aphp-1701-a
php-1701-a
 
Release your refactoring superpower
Release your refactoring superpowerRelease your refactoring superpower
Release your refactoring superpower
 
Managing Technical Debt
Managing Technical DebtManaging Technical Debt
Managing Technical Debt
 
Developing PHP Applications Faster
Developing PHP Applications FasterDeveloping PHP Applications Faster
Developing PHP Applications Faster
 
Containing Quality
Containing QualityContaining Quality
Containing Quality
 
Debugging elephpants
Debugging elephpantsDebugging elephpants
Debugging elephpants
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshop
 
Expressive Microservice Framework Blastoff
Expressive Microservice Framework BlastoffExpressive Microservice Framework Blastoff
Expressive Microservice Framework Blastoff
 
Accidental professional
Accidental professionalAccidental professional
Accidental professional
 
Build great products
Build great productsBuild great products
Build great products
 
Does Your Code Measure Up?
Does Your Code Measure Up?Does Your Code Measure Up?
Does Your Code Measure Up?
 
Practical PHP Deployment with Jenkins
Practical PHP Deployment with JenkinsPractical PHP Deployment with Jenkins
Practical PHP Deployment with Jenkins
 
Virtualizing Development
Virtualizing DevelopmentVirtualizing Development
Virtualizing Development
 
Refactoring Legacy Code
Refactoring Legacy CodeRefactoring Legacy Code
Refactoring Legacy Code
 
Clean application development tutorial
Clean application development tutorialClean application development tutorial
Clean application development tutorial
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Vagrant for Virtualized Development
Vagrant for Virtualized DevelopmentVagrant for Virtualized Development
Vagrant for Virtualized Development
 

Último

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Deprecated: Foundations of Zend Framework 2

  • 1. Foundations of Zend Framework 2 By: Adam Culp Twitter: @adamculp https://joind.in/14923
  • 2. 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
  • 3. Foundations of Zend Framework 2  What is...  Uses PHP >= 5.5  Open Source  On GitHub  Diverse Install  Pyrus, Composer, Git Submodules  Built on MVC design pattern  Can be used as components or entire framework
  • 4. Foundations of Zend Framework 2  Skeleton Application  Git clone Zendframework Skeleton Application  Github /zendframework/ZendSkeletonApplication
  • 5. Foundations of Zend Framework 2  Composer  Update Composer  php composer.phar self-update  Install Zend Framework 2  php composer.phar install  Creates and/or populates '/vendor' directory  Clones Zend Framework 2  Sets up Composer autoloader (PSR-0)
  • 6. Foundations of Zend Framework 2  Composer (easiest)  Update Composer  php composer.phar self-update  Create Project  php composer create-project zendframework/skeleton-application
  • 7. Foundations of Zend Framework 2  Structure
  • 8. Foundations of Zend Framework 2  Zend Framework 2 Usage  NO MAGIC!!!  Configuration driven  No forced structure  Uses namespaces
  • 9. Foundations of Zend Framework 2  MVC  Very briefly
  • 10. Foundations of Zend Framework 2  M = Model  Model = Business Logic, Data  Models  Database  Entities  Services
  • 11. Foundations of Zend Framework 2  V = View  View = GUI, Presentation, Visual Representation  HTML  CSS  Javascript  JSON  XML  NO BUSINESS LOGIC!
  • 12. Foundations of Zend Framework 2  C = Controller  Controller = Link between a user and the system.  Places calls to Model layer.  Passes needed info to the View layer.
  • 13. Foundations of Zend Framework 2  Typical Application Flow - Load  index.php  Loads autoloader (PSR-0 = default)  init Application using application.config.php
  • 14. 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 settings, etc.)
  • 15. Foundations of Zend Framework 2  Modules  Related for a specific “problem”.  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
  • 16. Foundations of Zend Framework 2  Module  Contents  PHP Code  MVC Functionality  Library Code  Though better in Application or via Composer  May not be related to MVC  View scripts  Public assets (images, css, javascript)  More?
  • 17. Foundations of Zend Framework 2  Modules  Easy creation using Zend Skeleton Module  GitHub /zendframework/ZendSkeletonModule
  • 18. 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 define services and wire event listeners as needed.
  • 19. Foundations of Zend Framework 2  Typical Application Flow – Module Config  module.config.php  Containers are component specific  Routes  Navigation  Service Manager  Translator  Controllers  View Manager  Steer clear of Closures (Anonymous Functions)  Do not cache well within array.  Less performant (parsed and compiled on every req) as a factory only parsed when service is used.
  • 20. 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
  • 21. Foundations of Zend Framework 2  Route Example /module/Application/config/module.config.php
  • 22. Foundations of Zend Framework 2  Navigation and Sitemaps (optional)  Driven by configuration. /module/Application/config/module.config.php
  • 23. Foundations of Zend Framework 2  Navigation and Sitemaps (optional)  Use in Layout or View. /module/Application/view/layout/layout.phtml
  • 24. Foundations of Zend Framework 2  Database  3 different ways to interact with data:  DB  Select  Table Gateway  Or use an ORM of your choosing
  • 25. Foundations of Zend Framework 2  Services  ALL THE THINGS!
  • 26. Foundations of Zend Framework 2  ServiceManager  Recommended alternative to ZendDi  Di pure DIC, SM is factory-based container (no magic, code explicitly details how instance created)  Can be created from:  Application configuration  Module classes  Module configuration  Local override configuration  Everything is a service, even Controllers (though provided by ControllerManager)
  • 27. Foundations of Zend Framework 2  Service Sample /module/Application/config/module.config.php
  • 28. Foundations of Zend Framework 2  Service Usage /module/Application/Module.php /module/Application/view/layout/layout.phtml
  • 29. 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)
  • 30. 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
  • 31. Foundations of Zend Framework 2  Diagram of MVC Events
  • 32. Foundations of Zend Framework 2  Events  Everything is an event  loadModule(s)  .resolve, .post  bootstrap  route  dispatch  dispatch.error  render  render.error  finish  sendResponse
  • 33. Foundations of Zend Framework 2  Event Sample /module/Application/Module.php
  • 34. Foundations of Zend Framework 2  Views  Directory Structure
  • 35. Foundations of Zend Framework 2  Views  View Model  Array carrying info to the view.  Automatically created, unless created specifically.  Hold Variable Containers for use in the View. /module/Application/Module.php /module/Application/view/layout/layout.phtml
  • 36. Foundations of Zend Framework 2  Forms Sample  Create elements /module/Products/src/Products/Form/ProductSearchForm.php
  • 37. Foundations of Zend Framework 2  Forms Sample  Pass the form to view /module/Products/src/Products/Controller/ProductsController.php
  • 38. Foundations of Zend Framework 2  Forms Sample  Output form in view /module/Products/view/products/products/search.phtml
  • 39. Foundations of Zend Framework 2  REST  AbstractRestfulController  Parsing JSON request bodies  View not needed (with Json View Strategy)  Contains methods to handle get, post, put, delete  Extend as needed
  • 40. Foundations of Zend Framework 2  REST Sample  Create Route /module/ProductsRest/config/module.config.php
  • 41. Foundations of Zend Framework 2  REST Sample  Apply Json View Strategy /module/ProductsRest/config/module.config.php
  • 42. Foundations of Zend Framework 2  REST Sample  Create result as JsonModel  No view files needed, outputs JSON /module/ProductsRest/src/Controller/ProductsController.php
  • 43. Foundations of Zend Framework 2  Apigility.org  Ensures well-formed API  Dev does less work
  • 44. 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  http://apigility.org
  • 45. Foundations of Zend Framework 2  Thank You!  Rate this talk: https://joind.in/14923  Code: https://github.com/adamculp/foundations-zf2-talk Adam Culp http://www.geekyboy.com http://RunGeekRadio.com Twitter @adamculp