SlideShare a Scribd company logo
Get started with 
Zend Framework 2 
Presenter : 
Pravasini Sahoo, Mindfire Solutions 
Date: 12th August 2014
About Me 
“ Working as a PHP Developer in MFS for around 4years. I started my professional career at Mindfire on 2010. I 
had done some projects using Zend 1.12 version and some using Zend 2. My skill is on PHP, MySQL, CSS, CSS3, 
HTML5, JQuery, AJAX, JavaScript, XML, ZendFramework, GoogleAnalytics, HTML , FacebookAPI, YouTubeAPI, 
OCP1, Znedframework2, TwitterBootstrap, JSON “ 
Certifications 
• Zend Certified Engineer (ZCE) 
Zend PHP 5.3 Certification 
• Oracle Certified Professional 
OCP MySQL 5 Developer - Part 1 - 1Z0-871 
• Microsoft Certified Professional 
MCP – Programming in HTML5 with JavaScript and CSS3 – MCTS 70-480 
2 | 12 Aug 2014
Agenda 
1. Introduction to Framework 
2. What is MVC? 
3. Why to use Zend Framework 2? 
4. Zend2 Installation 
5. Control Flow 
6. Demo on a CRUD application 
3 | 12 Aug 2014
Introduction to Framework 
4 | 12 Aug 2014
1. Introduction to Framework 
“A Framework is a universal, reusable software platform to 
develop software applications, products and solutions. In other 
words, we can say it is some kind of library, a piece of software, 
which provide web developers with code base and consistent 
standardized ways of creating web applications”. 
5 | 12 Aug 2014
Benefits of using Framework 
1. Code and File Organization 
2. The MVC Pattern 
3. Enforcing of Good Coding Standards 
4. Utilities and Libraries 
5. Less Code & Faster Development 
6. Community Support 
7. Security 
8. Performance Tools 
9. Simplified and Pretty URLs 
10. Efficiently Access Database ... and lot more 
6 | 12 Aug 2014
What is MVC? 
7 | 12 Aug 2014
2. What is MVC? 
MVC is a software architecture - the structure of the system - that separates 
domain/application/business (whatever you prefer) logic from the rest of 
the user interface. It does this by separating the application into three parts: 
the model, the view, and the controller. 
The controller receives user input and makes calls to model objects and the 
view to perform appropriate actions. 
The model manages fundamental behaviors and data of the application. 
The view effectively provides the user interface element of the application. 
8 | 12 Aug 2014
An XYZ Company Hierarchy 
INFORMATION 
DESK 
DEPARTMENT ONE DEPARTMENT TWO 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
9 | 12 Aug 2014
Customer arrives…. 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
10 | 12 Aug 2014 
DEPARTMENT ONE DEPARTMENT TWO
Information desk greets him/her 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
11 | 12 Aug 2014
..gives him/her directions.. 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
12 | 12 Aug 2014
Warehouse folks do things 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
13 | 12 Aug 2014
Stuff is ready for delivery 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
14 | 12 Aug 2014
Customer is happy. 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
15 | 12 Aug 2014
16 | 12 Aug 2014
17 | 12 Aug 2014
http://framework.zend.com/ 
18 | 12 Aug 2014
Our Application 
VIEW VIEW 
CONTROLLER CONTROLLER 
MODEL 
19 | 12 Aug 2014
Back to the XYZ company… 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
20 | 12 Aug 2014
Why to use Framework 2? 
21 | 12 Aug 2014
We need to move a department.. 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
22 | 12 Aug 2014
Dependency problem 
INFORMATION 
DESK 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
23 | 12 Aug 2014
In our Application 
VIEW VIEW 
CONTROLLER CONTROLLER 
MODEL 
24 | 12 Aug 2014
Same problem 
VIEW VIEW 
CONTROLLER CONTROLLER 
MODEL 
25 | 12 Aug 2014
Solving company problem 
ACCOUNTS MANAGER ACCOUNTS MANAGER 
TECHNICAL OFFICE TECHNICAL OFFICE 
WAREHOUSE 
INFORMATION 
DESK 
WAREHOUSE 
26 | 12 Aug 2014
Same with our application 
VIEW VIEW 
CONTROLLER CONTROLLER 
MODEL MODEL 
27 | 12 Aug 2014
Project delivered ! 
VIEW 
CONTROLLER 
VIEW 
CONTROLLER 
MODEL 
MODEL 
28 | 12 Aug 2014
Let’s start a new one… 
VIEW 
CONTROLLER 
VIEW 
CONTROLLER 
MODEL 
MODEL 
29 | 12 Aug 2014
Hey ! We need this thing 
VIEW 
CONTROLLER 
VIEW 
CONTROLLER 
MODEL 
MODEL 
30 | 12 Aug 2014
Problem Solved ! 
VIEW 
CONTROLLER 
VIEW 
CONTROLLER 
MODEL 
MODEL VIEW 
CONTROLLER 
MODEL 
31 | 12 Aug 2014
http://framework.zend.com/ 
32 | 12 Aug 2014
Namespace + Module.php = Module 
33 | 12 Aug 2014
Namespace + Module.php = Module 
Namespace Album; 
Class Module { } 
34 | 12 Aug 2014
What’s in a Module ? 
Feature 
35 | 12 Aug 2014
What’s in a Module ? 
Feature 
Routing 
Controller 
View 
PHP Classes 
Configuration 
. . . 
36 | 12 Aug 2014
Business Logic Hints 
Feature 
Routing 
Controller 
View 
PHP Classes 
Configuration 
. . . 
Services 
Helpers/ Plugins 
Mappers 
. . . 
37 | 12 Aug 2014
Zend2 Installation 
38 | 12 Aug 2014
Cloning 
git clone 
https://github.com/zendframework/ZendSkeletonApplication 
39 | 12 Aug 2014
Composer.json 
{ 
"name": "zendframework/skeleton-application", 
"description": "Skeleton Application for ZF2", 
"license": "BSD-3-Clause", 
"keywords": [ 
"framework", 
"zf2" 
], 
"homepage": "http://framework.zend.com/", 
"require": { 
"php": ">=5.3.3", 
"zendframework/zendframework": "2.3.*" 
} 
} 
40 | 12 Aug 2014
Composer.json 
{ 
"name": "zendframework/skeleton-application", 
"description": "Skeleton Application for ZF2", 
"license": "BSD-3-Clause", 
"keywords": [ 
"framework", 
"zf2" 
], 
"homepage": "http://framework.zend.com/", 
"require": { 
"php": ">=5.3.3", 
"zendframework/zendframework": "2.3.*" 
} 
} 
41 | 12 Aug 2014
Installation 
cd ZendSkeletonApplication 
php composer.phar self-update 
php composer.phar install 
42 | 12 Aug 2014
Installation 
cd ZendSkeletonApplication 
php composer.phar self-update 
> Installing zendframework/zendframework 
43 | 12 Aug 2014
File System Layout 
44 | 12 Aug 2014
File System Layout 
Application wide configuration 
45 | 12 Aug 2014
File System Layout 
document, cached file, coding 
standard and guidelines 
46 | 12 Aug 2014
File System Layout 
Public Document Root 
47 | 12 Aug 2014
File System Layout 
Our Modules 
48 | 12 Aug 2014
File System Layout 
} Third Party Modules 
49 | 12 Aug 2014
Focusing on a module… 
Module specific configuration 
50 | 12 Aug 2014
What’s inside a module ? 
Module PHP Source Files 
(Controller, Form, Model, Services …) 
51 | 12 Aug 2014
What’s inside a module ? 
Module test files 
52 | 12 Aug 2014
What’s inside a module ? 
View Stuff 
(view files, layouts, partials) 
53 | 12 Aug 2014
Control Flow 
54 | 12 Aug 2014
index.php 
<?php 
/** 
* This makes our life easier when dealing with paths. Everything is relative 
* to the application root now. 
*/ 
chdir(dirname(__DIR__)); 
// Decline static file requests back to the PHP built-in webserver 
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . 
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { 
return false; 
} 
// Setup autoloading 
require 'init_autoloader.php'; 
// Run the application! 
ZendMvcApplication::init(require 'config/application.config.php')->run(); 
55 | 12 Aug 2014
index.php 
<?php 
/** 
* This makes our life easier when dealing with paths. Everything is relative 
* to the application root now. 
*/ 
chdir(dirname(__DIR__)); 
// Decline static file requests back to the PHP built-in webserver 
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . 
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { 
return false; 
} 
// Setup autoloading 
require 'init_autoloader.php'; 
// Run the application! 
ZendMvcApplication::init(require 'config/application.config.php')->run(); 
56 | 12 Aug 2014
Config/application.config.php 
<?php 
return array( 
// This should be an array of module namespaces used in the application. 
'modules' => array( 
'Application', 
'Album' 
), 
// These are various options for the listeners attached to the ModuleManager 
'module_listener_options' => array( 
'module_paths' => array( 
'./module', 
'./vendor', 
), 
'config_glob_paths' => array( 
'config/autoload/{,*.}{global,local}.php', 
) 
) 
); 
57 | 12 Aug 2014
Module.php 
namespace Application; 
use ZendMvcModuleRouteListener; 
use ZendMvcMvcEvent; 
class Module 
{ 
public function onBootstrap(MvcEvent $e) 
{ ... } 
public function getConfig() { 
return include __DIR__ . '/config/module.config.php'; 
} 
public function getAutoloaderConfig() 
{ ... } 
} 
58 | 12 Aug 2014
Module configuration file 
// config/module.config.php 
return array( 
'router' => array( 
'routes' => array(...) 
), 
'controllers' => array(...), 
'service_manager' => array(...), 
'view_manager' => array(...), 
... 
) 
59 | 12 Aug 2014
Controllers 
namespace ApplicationController; 
use ZendMvcControllerAbstractActionController; 
use ZendViewModelViewModel; 
class IndexController extends AbstractActionController 
{ 
public function indexAction() 
{ 
return new ViewModel(); 
} 
} 
60 | 12 Aug 2014
Actions 
namespace ApplicationController; 
use ZendMvcControllerAbstractActionController; 
use ZendViewModelViewModel; 
class IndexController extends AbstractActionController 
{ 
public function indexAction() 
{ 
return new ViewModel(); 
} 
} 
61 | 12 Aug 2014
Feature A 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
62 | 12 Aug 2014
Feature A 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Feature B 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Feature C 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
63 | 12 Aug 2014
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Modules are merged at runtime 
64 | 12 Aug 2014
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Routing 
Controller 
Views 
PHP Classes 
. . . 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Modules are merged at runtime 
Configurations 
65 | 12 Aug 2014
We can override things… 
Views / Layouts 
Routing Rules 
All Other Configuration Parameters 
66 | 12 Aug 2014
We can override things 
Views / Layouts 
Routing Rules } 
All Other Configuration Parameters 
Do NOT modify 
original 3rd party 
modules! 
67 | 12 Aug 2014
Custom configuration 
} Do not modify anything from here ! 
68 | 12 Aug 2014
Modules are merged at runtime 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
Routing 
Controller 
Views 
PHP Classes 
Configurations 
. . . 
69 | 12 Aug 2014
This happens for all modules 
config/application.config.php 
return array( 
'modules' => array( 
'DoctrineModule', 
'DoctrineORMModule', 
'Application', 
), 
), 
... 
70 | 12 Aug 2014 
} Order is important
Demo on a CRUD application 
71 | 12 Aug 2014
References 
1. http://framework.zend.com/manual/2.0/en/ref/overview.html 
2. http://framework.zend.com/manual/2.0/en/user-guide/modules.html 
3. http://framework.zend.com/about/faq/ 
4. http://www.slideshare.net/maraspin/zf2-modular-architecture-taking-advantage- 
of-it 
5. http://blog.hock.in/2012/09/06/zf2-for-zf1-users-part-1/ 
6. http://stackoverflow.com/questions/12314300/zend-framework-1-vs-zend-framework- 
2-performance 
72 | 12 Aug 2014
73 | 12 Aug 2014 
Q & A
Thank You ! 
74 | 12 Aug 2014

More Related Content

PPT
Zend Framework Introduction
Rafael Monteiro
 
PDF
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
PDF
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
PDF
Quick start on Zend Framework 2
Enrico Zimuel
 
PDF
ZF2 Modular Architecture - Taking advantage of it
Steve Maraspin
 
PPTX
WordPress and Zend Framework Integration with Vulnero
Andrew Kandels
 
PPT
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
PPTX
Intro to Angular.js & Zend2 for Front-End Web Applications
TECKpert, Hubdin
 
Zend Framework Introduction
Rafael Monteiro
 
Zend Framework 2, What's new, Confoo 2011
Bachkoutou Toutou
 
Deprecated: Foundations of Zend Framework 2
Adam Culp
 
Quick start on Zend Framework 2
Enrico Zimuel
 
ZF2 Modular Architecture - Taking advantage of it
Steve Maraspin
 
WordPress and Zend Framework Integration with Vulnero
Andrew Kandels
 
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
Intro to Angular.js & Zend2 for Front-End Web Applications
TECKpert, Hubdin
 

What's hot (20)

PDF
Writing Services with ZF2
Mike Willbanks
 
KEY
Zend_Tool: Practical use and Extending
ZendCon
 
ODP
When dynamic becomes static
Wim Godden
 
PPT
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 
PDF
Zend Core on IBM i - Security Considerations
ZendCon
 
PDF
Zend Framework 2 - presentation
yamcsha
 
PDF
Cryptography with Zend Framework
Enrico Zimuel
 
PDF
Zend con practical-zf1-zf2-migration
Clark Everetts
 
PPT
slide to delete
alind tiwari
 
PDF
Instant ACLs with Zend Framework 2
Stefano Valle
 
PDF
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan
 
PDF
BMO - Intelligent Projects with Maven
Mert Çalışkan
 
PDF
Performance tuning with zend framework
Alan Seiden
 
PPT
PHP on Windows - What's New
ZendCon
 
PDF
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
PDF
Jdc 2010 - Maven, Intelligent Projects
Mert Çalışkan
 
PDF
Apache DeltaSpike the CDI toolbox
Antoine Sabot-Durand
 
PPTX
Maven
feng lee
 
PDF
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Mario-Leander Reimer
 
Writing Services with ZF2
Mike Willbanks
 
Zend_Tool: Practical use and Extending
ZendCon
 
When dynamic becomes static
Wim Godden
 
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 
Zend Core on IBM i - Security Considerations
ZendCon
 
Zend Framework 2 - presentation
yamcsha
 
Cryptography with Zend Framework
Enrico Zimuel
 
Zend con practical-zf1-zf2-migration
Clark Everetts
 
slide to delete
alind tiwari
 
Instant ACLs with Zend Framework 2
Stefano Valle
 
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan
 
BMO - Intelligent Projects with Maven
Mert Çalışkan
 
Performance tuning with zend framework
Alan Seiden
 
PHP on Windows - What's New
ZendCon
 
jDays2015 - JavaEE vs. Spring Smackdown
Mert Çalışkan
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
Jdc 2010 - Maven, Intelligent Projects
Mert Çalışkan
 
Apache DeltaSpike the CDI toolbox
Antoine Sabot-Durand
 
Maven
feng lee
 
Migrating a JSF-Based Web Application from Spring 3 to Java EE 7 and CDI
Mario-Leander Reimer
 
Ad

Similar to Get Started with Zend Framework 2 (20)

PPT
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PPT
Unit Test for ZF SlideShare Component
Kaiuwe
 
PDF
Zend Framework Foundations
Chuck Reeves
 
PDF
Oracle SOA Suite 12c - News and Overview
Matthias Furrer
 
PDF
Oracle soa suite 12c - News
Trivadis
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PPT
Unit Test for ZF SlideShare Component
Diego Delon
 
PDF
Achievement Archive
Abdulrahman Gaber
 
DOCX
Sasmita bigdata resume
Sasmita Swain
 
ODP
PHPNW Drupal as a Framework
digital006
 
PPTX
Delivering Applications Continuously to Cloud
IBM UrbanCode Products
 
PPTX
DrupalCon LA 2015 Review
littleMAS
 
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Unit Test for ZF SlideShare Component
Kaiuwe
 
Zend Framework Foundations
Chuck Reeves
 
Oracle SOA Suite 12c - News and Overview
Matthias Furrer
 
Oracle soa suite 12c - News
Trivadis
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Unit Test for ZF SlideShare Component
Diego Delon
 
Achievement Archive
Abdulrahman Gaber
 
Sasmita bigdata resume
Sasmita Swain
 
PHPNW Drupal as a Framework
digital006
 
Delivering Applications Continuously to Cloud
IBM UrbanCode Products
 
DrupalCon LA 2015 Review
littleMAS
 
Ad

More from Mindfire Solutions (20)

PDF
Physician Search and Review
Mindfire Solutions
 
PDF
diet management app
Mindfire Solutions
 
PDF
Business Technology Solution
Mindfire Solutions
 
PDF
Remote Health Monitoring
Mindfire Solutions
 
PDF
Influencer Marketing Solution
Mindfire Solutions
 
PPT
High Availability of Azure Applications
Mindfire Solutions
 
PPTX
IOT Hands On
Mindfire Solutions
 
PPTX
Glimpse of Loops Vs Set
Mindfire Solutions
 
ODP
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
PPT
Adaptive Layout In iOS 8
Mindfire Solutions
 
PPT
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
PPT
LINQPad - utility Tool
Mindfire Solutions
 
PPT
Get started with watch kit development
Mindfire Solutions
 
PPTX
Swift vs Objective-C
Mindfire Solutions
 
ODP
Material Design in Android
Mindfire Solutions
 
ODP
Introduction to OData
Mindfire Solutions
 
PPT
Ext js Part 2- MVC
Mindfire Solutions
 
PPT
ExtJs Basic Part-1
Mindfire Solutions
 
PPT
Spring Security Introduction
Mindfire Solutions
 
Physician Search and Review
Mindfire Solutions
 
diet management app
Mindfire Solutions
 
Business Technology Solution
Mindfire Solutions
 
Remote Health Monitoring
Mindfire Solutions
 
Influencer Marketing Solution
Mindfire Solutions
 
High Availability of Azure Applications
Mindfire Solutions
 
IOT Hands On
Mindfire Solutions
 
Glimpse of Loops Vs Set
Mindfire Solutions
 
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
Adaptive Layout In iOS 8
Mindfire Solutions
 
Introduction to Auto-layout : iOS/Mac
Mindfire Solutions
 
LINQPad - utility Tool
Mindfire Solutions
 
Get started with watch kit development
Mindfire Solutions
 
Swift vs Objective-C
Mindfire Solutions
 
Material Design in Android
Mindfire Solutions
 
Introduction to OData
Mindfire Solutions
 
Ext js Part 2- MVC
Mindfire Solutions
 
ExtJs Basic Part-1
Mindfire Solutions
 
Spring Security Introduction
Mindfire Solutions
 

Recently uploaded (20)

PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PPTX
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PDF
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
Why Use Open Source Reporting Tools for Business Intelligence.pdf
Varsha Nayak
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
oapresentation.pptx
mehatdhavalrajubhai
 
Services offered by Dynamic Solutions in Pakistan
DaniyaalAdeemShibli1
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Presentation about variables and constant.pptx
safalsingh810
 
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 

Get Started with Zend Framework 2

  • 1. Get started with Zend Framework 2 Presenter : Pravasini Sahoo, Mindfire Solutions Date: 12th August 2014
  • 2. About Me “ Working as a PHP Developer in MFS for around 4years. I started my professional career at Mindfire on 2010. I had done some projects using Zend 1.12 version and some using Zend 2. My skill is on PHP, MySQL, CSS, CSS3, HTML5, JQuery, AJAX, JavaScript, XML, ZendFramework, GoogleAnalytics, HTML , FacebookAPI, YouTubeAPI, OCP1, Znedframework2, TwitterBootstrap, JSON “ Certifications • Zend Certified Engineer (ZCE) Zend PHP 5.3 Certification • Oracle Certified Professional OCP MySQL 5 Developer - Part 1 - 1Z0-871 • Microsoft Certified Professional MCP – Programming in HTML5 with JavaScript and CSS3 – MCTS 70-480 2 | 12 Aug 2014
  • 3. Agenda 1. Introduction to Framework 2. What is MVC? 3. Why to use Zend Framework 2? 4. Zend2 Installation 5. Control Flow 6. Demo on a CRUD application 3 | 12 Aug 2014
  • 4. Introduction to Framework 4 | 12 Aug 2014
  • 5. 1. Introduction to Framework “A Framework is a universal, reusable software platform to develop software applications, products and solutions. In other words, we can say it is some kind of library, a piece of software, which provide web developers with code base and consistent standardized ways of creating web applications”. 5 | 12 Aug 2014
  • 6. Benefits of using Framework 1. Code and File Organization 2. The MVC Pattern 3. Enforcing of Good Coding Standards 4. Utilities and Libraries 5. Less Code & Faster Development 6. Community Support 7. Security 8. Performance Tools 9. Simplified and Pretty URLs 10. Efficiently Access Database ... and lot more 6 | 12 Aug 2014
  • 7. What is MVC? 7 | 12 Aug 2014
  • 8. 2. What is MVC? MVC is a software architecture - the structure of the system - that separates domain/application/business (whatever you prefer) logic from the rest of the user interface. It does this by separating the application into three parts: the model, the view, and the controller. The controller receives user input and makes calls to model objects and the view to perform appropriate actions. The model manages fundamental behaviors and data of the application. The view effectively provides the user interface element of the application. 8 | 12 Aug 2014
  • 9. An XYZ Company Hierarchy INFORMATION DESK DEPARTMENT ONE DEPARTMENT TWO ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 9 | 12 Aug 2014
  • 10. Customer arrives…. INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 10 | 12 Aug 2014 DEPARTMENT ONE DEPARTMENT TWO
  • 11. Information desk greets him/her INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 11 | 12 Aug 2014
  • 12. ..gives him/her directions.. INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 12 | 12 Aug 2014
  • 13. Warehouse folks do things INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 13 | 12 Aug 2014
  • 14. Stuff is ready for delivery INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 14 | 12 Aug 2014
  • 15. Customer is happy. INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 15 | 12 Aug 2014
  • 16. 16 | 12 Aug 2014
  • 17. 17 | 12 Aug 2014
  • 19. Our Application VIEW VIEW CONTROLLER CONTROLLER MODEL 19 | 12 Aug 2014
  • 20. Back to the XYZ company… INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 20 | 12 Aug 2014
  • 21. Why to use Framework 2? 21 | 12 Aug 2014
  • 22. We need to move a department.. INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 22 | 12 Aug 2014
  • 23. Dependency problem INFORMATION DESK ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE 23 | 12 Aug 2014
  • 24. In our Application VIEW VIEW CONTROLLER CONTROLLER MODEL 24 | 12 Aug 2014
  • 25. Same problem VIEW VIEW CONTROLLER CONTROLLER MODEL 25 | 12 Aug 2014
  • 26. Solving company problem ACCOUNTS MANAGER ACCOUNTS MANAGER TECHNICAL OFFICE TECHNICAL OFFICE WAREHOUSE INFORMATION DESK WAREHOUSE 26 | 12 Aug 2014
  • 27. Same with our application VIEW VIEW CONTROLLER CONTROLLER MODEL MODEL 27 | 12 Aug 2014
  • 28. Project delivered ! VIEW CONTROLLER VIEW CONTROLLER MODEL MODEL 28 | 12 Aug 2014
  • 29. Let’s start a new one… VIEW CONTROLLER VIEW CONTROLLER MODEL MODEL 29 | 12 Aug 2014
  • 30. Hey ! We need this thing VIEW CONTROLLER VIEW CONTROLLER MODEL MODEL 30 | 12 Aug 2014
  • 31. Problem Solved ! VIEW CONTROLLER VIEW CONTROLLER MODEL MODEL VIEW CONTROLLER MODEL 31 | 12 Aug 2014
  • 33. Namespace + Module.php = Module 33 | 12 Aug 2014
  • 34. Namespace + Module.php = Module Namespace Album; Class Module { } 34 | 12 Aug 2014
  • 35. What’s in a Module ? Feature 35 | 12 Aug 2014
  • 36. What’s in a Module ? Feature Routing Controller View PHP Classes Configuration . . . 36 | 12 Aug 2014
  • 37. Business Logic Hints Feature Routing Controller View PHP Classes Configuration . . . Services Helpers/ Plugins Mappers . . . 37 | 12 Aug 2014
  • 38. Zend2 Installation 38 | 12 Aug 2014
  • 39. Cloning git clone https://github.com/zendframework/ZendSkeletonApplication 39 | 12 Aug 2014
  • 40. Composer.json { "name": "zendframework/skeleton-application", "description": "Skeleton Application for ZF2", "license": "BSD-3-Clause", "keywords": [ "framework", "zf2" ], "homepage": "http://framework.zend.com/", "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.3.*" } } 40 | 12 Aug 2014
  • 41. Composer.json { "name": "zendframework/skeleton-application", "description": "Skeleton Application for ZF2", "license": "BSD-3-Clause", "keywords": [ "framework", "zf2" ], "homepage": "http://framework.zend.com/", "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.3.*" } } 41 | 12 Aug 2014
  • 42. Installation cd ZendSkeletonApplication php composer.phar self-update php composer.phar install 42 | 12 Aug 2014
  • 43. Installation cd ZendSkeletonApplication php composer.phar self-update > Installing zendframework/zendframework 43 | 12 Aug 2014
  • 44. File System Layout 44 | 12 Aug 2014
  • 45. File System Layout Application wide configuration 45 | 12 Aug 2014
  • 46. File System Layout document, cached file, coding standard and guidelines 46 | 12 Aug 2014
  • 47. File System Layout Public Document Root 47 | 12 Aug 2014
  • 48. File System Layout Our Modules 48 | 12 Aug 2014
  • 49. File System Layout } Third Party Modules 49 | 12 Aug 2014
  • 50. Focusing on a module… Module specific configuration 50 | 12 Aug 2014
  • 51. What’s inside a module ? Module PHP Source Files (Controller, Form, Model, Services …) 51 | 12 Aug 2014
  • 52. What’s inside a module ? Module test files 52 | 12 Aug 2014
  • 53. What’s inside a module ? View Stuff (view files, layouts, partials) 53 | 12 Aug 2014
  • 54. Control Flow 54 | 12 Aug 2014
  • 55. index.php <?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Run the application! ZendMvcApplication::init(require 'config/application.config.php')->run(); 55 | 12 Aug 2014
  • 56. index.php <?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Run the application! ZendMvcApplication::init(require 'config/application.config.php')->run(); 56 | 12 Aug 2014
  • 57. Config/application.config.php <?php return array( // This should be an array of module namespaces used in the application. 'modules' => array( 'Application', 'Album' ), // These are various options for the listeners attached to the ModuleManager 'module_listener_options' => array( 'module_paths' => array( './module', './vendor', ), 'config_glob_paths' => array( 'config/autoload/{,*.}{global,local}.php', ) ) ); 57 | 12 Aug 2014
  • 58. Module.php namespace Application; use ZendMvcModuleRouteListener; use ZendMvcMvcEvent; class Module { public function onBootstrap(MvcEvent $e) { ... } public function getConfig() { return include __DIR__ . '/config/module.config.php'; } public function getAutoloaderConfig() { ... } } 58 | 12 Aug 2014
  • 59. Module configuration file // config/module.config.php return array( 'router' => array( 'routes' => array(...) ), 'controllers' => array(...), 'service_manager' => array(...), 'view_manager' => array(...), ... ) 59 | 12 Aug 2014
  • 60. Controllers namespace ApplicationController; use ZendMvcControllerAbstractActionController; use ZendViewModelViewModel; class IndexController extends AbstractActionController { public function indexAction() { return new ViewModel(); } } 60 | 12 Aug 2014
  • 61. Actions namespace ApplicationController; use ZendMvcControllerAbstractActionController; use ZendViewModelViewModel; class IndexController extends AbstractActionController { public function indexAction() { return new ViewModel(); } } 61 | 12 Aug 2014
  • 62. Feature A Routing Controller Views PHP Classes Configurations . . . 62 | 12 Aug 2014
  • 63. Feature A Routing Controller Views PHP Classes Configurations . . . Feature B Routing Controller Views PHP Classes Configurations . . . Feature C Routing Controller Views PHP Classes Configurations . . . 63 | 12 Aug 2014
  • 64. Routing Controller Views PHP Classes Configurations . . . Routing Controller Views PHP Classes Configurations . . . Routing Controller Views PHP Classes Configurations . . . Modules are merged at runtime 64 | 12 Aug 2014
  • 65. Routing Controller Views PHP Classes Configurations . . . Routing Controller Views PHP Classes . . . Routing Controller Views PHP Classes Configurations . . . Modules are merged at runtime Configurations 65 | 12 Aug 2014
  • 66. We can override things… Views / Layouts Routing Rules All Other Configuration Parameters 66 | 12 Aug 2014
  • 67. We can override things Views / Layouts Routing Rules } All Other Configuration Parameters Do NOT modify original 3rd party modules! 67 | 12 Aug 2014
  • 68. Custom configuration } Do not modify anything from here ! 68 | 12 Aug 2014
  • 69. Modules are merged at runtime Routing Controller Views PHP Classes Configurations . . . Routing Controller Views PHP Classes Configurations . . . Routing Controller Views PHP Classes Configurations . . . 69 | 12 Aug 2014
  • 70. This happens for all modules config/application.config.php return array( 'modules' => array( 'DoctrineModule', 'DoctrineORMModule', 'Application', ), ), ... 70 | 12 Aug 2014 } Order is important
  • 71. Demo on a CRUD application 71 | 12 Aug 2014
  • 72. References 1. http://framework.zend.com/manual/2.0/en/ref/overview.html 2. http://framework.zend.com/manual/2.0/en/user-guide/modules.html 3. http://framework.zend.com/about/faq/ 4. http://www.slideshare.net/maraspin/zf2-modular-architecture-taking-advantage- of-it 5. http://blog.hock.in/2012/09/06/zf2-for-zf1-users-part-1/ 6. http://stackoverflow.com/questions/12314300/zend-framework-1-vs-zend-framework- 2-performance 72 | 12 Aug 2014
  • 73. 73 | 12 Aug 2014 Q & A
  • 74. Thank You ! 74 | 12 Aug 2014