SlideShare a Scribd company logo
July 18, 2014
Tarun Kumar Singhal
Zend Framework 2
Zend Framework 2
Discussion Points
About
Directory Tree Structure
Skeleton Application
Composer
Routing
Session Management
CSS Styleshet and Twitter Bootstrap
Module Custom Config file
Service Manager
Database Connectivity with one or more
About

Zend Framework 2 is an open source framework for
developing web applications and services using
PHP 5.3+.

Zend Framework 2 uses 100% object-oriented code
and utilises most of the new features of PHP 5.3,
namely namespaces, late static binding, lambda
functions and closures.
Zend Framework 2
Directory Tree Structure
config/
---autoload/
---*.config.php
data
module
---ModuleName
------config
------language
------src
---------ModuleName
------------Controller
------------Form
------------Model
------view
public
vendor
• The top level of the module
contains organisational directories
along with the “Module.php” and
“autoload_classmap.php” files.
• config - for configuration files
src - for PHP classes
view - for view scripts
Zend Framework 2
Application Code-Flow
Zend Framework 2
Zend Framework 2
Skeleton Application
With the help of composer
# curl -sS https://getcomposer.org/installer | php // to get the composer.phar file
# php composer.phar create-project -sdev --repository-
url="https://packages.zendframework.com" zendframework/skeleton-application
path/to/install
# php composer.phar update
With the help of GIT
# Go to https://github.com/zendframework/ZendSkeletonApplication
Then click the “Zip” button. This will download the file with a name like
ZendSkeletonApplication-master.zip or similar.
Zend Framework 2
Composer
Composer is a tool for dependency management in PHP.
It deals with "packages" or libraries, but it manages them on a per-project
basis, installing them in a directory (e.g. vendor) inside your project.
The problem that Composer solves is this:
You have a project that depends on a number of libraries.
Some of those libraries depend on other libraries.
You declare the things you depend on.
Composer finds out which versions of which packages need to be
installed, and installs them
Zend Framework 2
Routing
Routing is the act of matching a request
to a given controller.
Routes are stored in the
“module.config.php” file found in the
config directory. In this file you can
modify existing routes and add new
routes.
Zend Framework 2
Session Management
Zend Framework 2
The session manager is a class that is responsible for all aspects of session management.
It initializes and configures configuration, storage and save handling.
Usage:
In module Controller class:
Use ZendSessionContainer;
In Action:
$session = new Container('User');
//to set session
$session->offsetSet('UserName', 'Demo User');
//get session
$session->offsetGet('UserName');
//session exist check
$session->offsetExists('UserName');
//destory session
$session->offsetUnset('UserName');
CSS Stylesheets and Twitter
Bootstrap
This is provided by default in ZF2 framework skeleton application.
Bootstrap has became a popular CSS framework, allowing to make your
web site professionally looking and visually appealing, even if you don’t
have advanced designer skills and without the need of creating basic
CSS rules (but, of course you can define your own custom CSS rules on
top of Bootstrap to customise your site’s appearance). Bootstrap is
freely distributed under the Apache License v.2.0.
Zend Framework 2
Cont...
Generally, the Bootstrap does the following things:
• It provides the CSS reset that is a style sheet defining styles for all
possible HTML elements. This ensures your web site will look the same
way in all web browsers.
• It provides the base CSS rules that define style of typography
(headings and text), tables, forms, buttons, images and so on.
• It defines the grid system. The grid system allows to arrange elements
on your web page in a grid-like structure.
• It defines useful web interface components like dropdown menus,
navigation bars, breadcrumbs, pagination and so on.
• It includes the JavaScript extensions that allow to make Bootstrap-
provided interface components more interactive. For example,
JavaScript is used to animate dropdown menus and display “modal
dialogs”.
Zend Framework 2
Demo
BitBucket Help URL : https://bitbucket.org/dlu/dlutwbootstrap
Download the Twitter-Bootstrap module to use bootstrap CSS
Module: dlu/DluTwBootstrap via zend studio
Zend Framework 2
Modules Custom Config file
>> Create custom config file at module's config
dir:
<?php
return array(
'report' => array(
'name' => 'Name'
),
);?>
>> In Controller's action of Module:
<?php
$config = $this->getServiceLocator ()->get
( 'config' );
$data = $config['report'];
>> Update method of config in module's
Module.php to merge the config array
Zend Framework 2
Service Manager
ServiceManager component is an implementation of the Service
Locator pattern.
OR, we can say
A simple application registry that provides objects (in a lazy
loaded fashion) within application as needed – but with some nice
additions.
Zend Framework 2
Database Connectivity with one
Database
Zend Framework 2
Database Connectivity with
multiple Database
Zend Framework 2
Thank You
Zend Framework 2

More Related Content

What's hot (20)

PDF
Zend Framework 2 Components
Shawn Stratton
 
PPTX
Get Started with Zend Framework 2
Mindfire Solutions
 
PDF
Instant ACLs with Zend Framework 2
Stefano Valle
 
PDF
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf Conference
 
PDF
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf Conference
 
PDF
Cryptography with Zend Framework
Enrico Zimuel
 
PDF
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Fwdays
 
PPT
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf Conference
 
PPTX
WordPress and Zend Framework Integration with Vulnero
Andrew Kandels
 
PPTX
Zf2 phpquebec
mkherlakian
 
PDF
Zend Framework 2 Patterns
Zend by Rogue Wave Software
 
PPT
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
PDF
You must know about CodeIgniter Popular Library
Bo-Yi Wu
 
KEY
Extending Zend_Tool
Ralph Schindler
 
PDF
Drupal 8 - Core and API Changes
Shabir Ahmad
 
PPT
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 
PDF
How to build customizable multitenant web applications - PHPBNL11
Stephan Hochdörfer
 
PDF
Modular architecture today
pragkirk
 
PDF
Symfony2 - from the trenches
Lukas Smith
 
PPSX
RequireJS
Tim Doherty
 
Zend Framework 2 Components
Shawn Stratton
 
Get Started with Zend Framework 2
Mindfire Solutions
 
Instant ACLs with Zend Framework 2
Stefano Valle
 
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf Conference
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf Conference
 
Cryptography with Zend Framework
Enrico Zimuel
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Fwdays
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf Conference
 
WordPress and Zend Framework Integration with Vulnero
Andrew Kandels
 
Zf2 phpquebec
mkherlakian
 
Zend Framework 2 Patterns
Zend by Rogue Wave Software
 
2007 Zend Con Mvc Edited Irmantas
Irmantas Šiupšinskas
 
You must know about CodeIgniter Popular Library
Bo-Yi Wu
 
Extending Zend_Tool
Ralph Schindler
 
Drupal 8 - Core and API Changes
Shabir Ahmad
 
Using Zend_Tool to Establish Your Project's Skeleton
Jeremy Brown
 
How to build customizable multitenant web applications - PHPBNL11
Stephan Hochdörfer
 
Modular architecture today
pragkirk
 
Symfony2 - from the trenches
Lukas Smith
 
RequireJS
Tim Doherty
 

Similar to Zend Framework 2 (20)

PDF
OroCRM Partner Technical Training: September 2015
Oro Inc.
 
PPT
JavaScript Modules in Practice
Maghdebura
 
PPTX
Magento 2.0: Prepare yourself for a new way of module development
Ivan Chepurnyi
 
PPT
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
PDF
Social Connections VI — IBM Connections Extensions and Themes Demystified
Claudio Procida
 
PDF
Zend Framework Quick Start Walkthrough
Bradley Holt
 
PPTX
Yii in action
KeaNy Chu
 
PDF
IRJET- Lightweight MVC Framework in PHP
IRJET Journal
 
PDF
Fundamentals of Extending Magento 2 - php[world] 2015
David Alger
 
PDF
Staying Sane with Drupal NEPHP
Oscar Merida
 
PDF
Foundations of Zend Framework
Adam Culp
 
PPT
TomatoCMS in A Nutshell
Siwawong Wuttipongprasert
 
PDF
Magento2 Basics for Frontend Development
Kapil Dev Singh
 
PDF
Architecture Specification - Visual Modeling Tool
Adriaan Venter
 
PDF
Code igniter - A brief introduction
Commit University
 
PPT
Struts
Ranjan Kumar
 
PPT
apresentacao_apache2..
webhostingguy
 
PPT
apresentacao_apache2..
webhostingguy
 
OroCRM Partner Technical Training: September 2015
Oro Inc.
 
JavaScript Modules in Practice
Maghdebura
 
Magento 2.0: Prepare yourself for a new way of module development
Ivan Chepurnyi
 
Edp bootstrapping a-software_company
Ganesh Kulkarni
 
Social Connections VI — IBM Connections Extensions and Themes Demystified
Claudio Procida
 
Zend Framework Quick Start Walkthrough
Bradley Holt
 
Yii in action
KeaNy Chu
 
IRJET- Lightweight MVC Framework in PHP
IRJET Journal
 
Fundamentals of Extending Magento 2 - php[world] 2015
David Alger
 
Staying Sane with Drupal NEPHP
Oscar Merida
 
Foundations of Zend Framework
Adam Culp
 
TomatoCMS in A Nutshell
Siwawong Wuttipongprasert
 
Magento2 Basics for Frontend Development
Kapil Dev Singh
 
Architecture Specification - Visual Modeling Tool
Adriaan Venter
 
Code igniter - A brief introduction
Commit University
 
Struts
Ranjan Kumar
 
apresentacao_apache2..
webhostingguy
 
apresentacao_apache2..
webhostingguy
 
Ad

Recently uploaded (20)

PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
July Patch Tuesday
Ivanti
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
July Patch Tuesday
Ivanti
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Ad

Zend Framework 2

  • 1. July 18, 2014 Tarun Kumar Singhal Zend Framework 2
  • 2. Zend Framework 2 Discussion Points About Directory Tree Structure Skeleton Application Composer Routing Session Management CSS Styleshet and Twitter Bootstrap Module Custom Config file Service Manager Database Connectivity with one or more
  • 3. About  Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+.  Zend Framework 2 uses 100% object-oriented code and utilises most of the new features of PHP 5.3, namely namespaces, late static binding, lambda functions and closures. Zend Framework 2
  • 4. Directory Tree Structure config/ ---autoload/ ---*.config.php data module ---ModuleName ------config ------language ------src ---------ModuleName ------------Controller ------------Form ------------Model ------view public vendor • The top level of the module contains organisational directories along with the “Module.php” and “autoload_classmap.php” files. • config - for configuration files src - for PHP classes view - for view scripts Zend Framework 2
  • 7. Skeleton Application With the help of composer # curl -sS https://getcomposer.org/installer | php // to get the composer.phar file # php composer.phar create-project -sdev --repository- url="https://packages.zendframework.com" zendframework/skeleton-application path/to/install # php composer.phar update With the help of GIT # Go to https://github.com/zendframework/ZendSkeletonApplication Then click the “Zip” button. This will download the file with a name like ZendSkeletonApplication-master.zip or similar. Zend Framework 2
  • 8. Composer Composer is a tool for dependency management in PHP. It deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. The problem that Composer solves is this: You have a project that depends on a number of libraries. Some of those libraries depend on other libraries. You declare the things you depend on. Composer finds out which versions of which packages need to be installed, and installs them Zend Framework 2
  • 9. Routing Routing is the act of matching a request to a given controller. Routes are stored in the “module.config.php” file found in the config directory. In this file you can modify existing routes and add new routes. Zend Framework 2
  • 10. Session Management Zend Framework 2 The session manager is a class that is responsible for all aspects of session management. It initializes and configures configuration, storage and save handling. Usage: In module Controller class: Use ZendSessionContainer; In Action: $session = new Container('User'); //to set session $session->offsetSet('UserName', 'Demo User'); //get session $session->offsetGet('UserName'); //session exist check $session->offsetExists('UserName'); //destory session $session->offsetUnset('UserName');
  • 11. CSS Stylesheets and Twitter Bootstrap This is provided by default in ZF2 framework skeleton application. Bootstrap has became a popular CSS framework, allowing to make your web site professionally looking and visually appealing, even if you don’t have advanced designer skills and without the need of creating basic CSS rules (but, of course you can define your own custom CSS rules on top of Bootstrap to customise your site’s appearance). Bootstrap is freely distributed under the Apache License v.2.0. Zend Framework 2
  • 12. Cont... Generally, the Bootstrap does the following things: • It provides the CSS reset that is a style sheet defining styles for all possible HTML elements. This ensures your web site will look the same way in all web browsers. • It provides the base CSS rules that define style of typography (headings and text), tables, forms, buttons, images and so on. • It defines the grid system. The grid system allows to arrange elements on your web page in a grid-like structure. • It defines useful web interface components like dropdown menus, navigation bars, breadcrumbs, pagination and so on. • It includes the JavaScript extensions that allow to make Bootstrap- provided interface components more interactive. For example, JavaScript is used to animate dropdown menus and display “modal dialogs”. Zend Framework 2
  • 13. Demo BitBucket Help URL : https://bitbucket.org/dlu/dlutwbootstrap Download the Twitter-Bootstrap module to use bootstrap CSS Module: dlu/DluTwBootstrap via zend studio Zend Framework 2
  • 14. Modules Custom Config file >> Create custom config file at module's config dir: <?php return array( 'report' => array( 'name' => 'Name' ), );?> >> In Controller's action of Module: <?php $config = $this->getServiceLocator ()->get ( 'config' ); $data = $config['report']; >> Update method of config in module's Module.php to merge the config array Zend Framework 2
  • 15. Service Manager ServiceManager component is an implementation of the Service Locator pattern. OR, we can say A simple application registry that provides objects (in a lazy loaded fashion) within application as needed – but with some nice additions. Zend Framework 2
  • 16. Database Connectivity with one Database Zend Framework 2
  • 17. Database Connectivity with multiple Database Zend Framework 2