SlideShare a Scribd company logo
1 of 21
Download to read offline
Zend Framework
Quick Start Walk Through

           Bradley Holt
  <bradley.holt@foundline.com>
           Found Line
Introduction

  Zend Framework is a quot;gluequot; framework that also provides
  an MVC quot;stack.quot;
  Provides much flexibility but quot;best practicesquot; are still
  sometimes hard to figure out (there are proposals that
  address this such as Zend_Console & Zend_Build).
  This presentation will focus mainly on what is suggested in
  Zend Framework documentation.
Why We Chose Zend Framework

 Clear separation between design and development (MVC)
 Gives a starting point for code reuse (coding standards,
 namespace organization, etc.)
 quot;Use-at-willquot; architecture - if I don't like something I can
 extend or replace it
 Great documentation
 Permissive open source license (modified BSD)
 Doesn't hurt to have quot;The PHP Companyquot; behind it
Resources

 Zend Framework installation
 Zend_Controller quick start
 Example web application on Google Code
Installation

  Make sure you have PHP 5.1.4 or later (full system
  requirements).
  Download the latest stable release, download the latest
  nightly snapshot, or use a Subversion (SVN) client to get a
  copy of Zend Framework.
  Make sure your PHP include_path contains the path to the
  Zend Framework library.
  Zend Framework contains many components that may now
  be used in your web application even if you decide not to
  use Zend Framework MVC.
Zend Framework MVC Overview

 Model - many options including Zend_Db & Zend_Service
 View - Zend_View
 Controller - Zend_Controller
 Zend_Controller_Front uses a Front Controller pattern.
 Incoming requests are dispatched to Action Controllers
 based on the requested URL:
    http://example.com
    http://example.com/controller
    http://example.com/controller /action
    http://example.com/controller /action /key /value
File System Layout
application/
   controllers/
      ErrorController.php
      IndexController.php
   models/
   views/
      scripts/
          error/
             error.phtml
          index/
             index.phtml
      helpers/
      filters/
html/
   .htaccess
   index.php
library/
   Zend/
html/

  Your web server's document root.
  Contains the bootstrap file which all requests are routed
  through.
  Contains the .htaccess file which uses mod_rewrite to make
  sure all requests are rewritten to your bootstrap file.
  You can use regex so that requests for static files (e.g. js,
  ico, gif, jpg, png, css) are not rewritten to your bootstrap file.
html/.htaccess

RewriteEngine on
RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php

php_value include_path ../library
php_flag register_globals off
php_value error_reporting 2047
php_flag display_errors on
html/index.php (bootstrap file)

<?php
require_once 'Zend/Controller/Front.php';
Zend_Controller_Front::run('../application/controllers');
application/controllers/

  Contains the Action Controllers for your web application.
  Each of your Action Controller will extend the
  Zend_Controller_Action class.
  Each of your Action Controller class names should end in
  quot;Controller.quot; For example: FooController.
  Each Action Controller can have multiple actions
  represented by public functions ending in the name quot;Action.quot;
  For example: barAction().
application/controllers/
IndexController.php
<?php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action
{
   public function indexAction()
   {
   }
}
application/views/scripts/

  Contains the view scripts for your web application.
  Default extension for view scripts is .phtml.
  Controller name is used to match the directory and action
  name is used to match the view script.

  Given FooController::barAction() the view script would be
  foo/bar.phtml.
application/views/scripts/index/
index.phtml
<!DOCTYPE html
PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html>
<head>
 <meta http-equiv=quot;Content-Typequot; content=quot;text/html;
charset=utf-8quot; />
 <title>My first Zend Framework App</title>
</head>
<body>
   <h1>Hello, World!</h1>
</body>
</html>
application/controllers/
ErrorController.php
<?php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

class ErrorController extends Zend_Controller_Action
{
   public function errorAction()
   {
   }
}
application/views/scripts/error/
error.phtml
<!DOCTYPE html
PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot;
quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;>
<html>
<head>
 <meta http-equiv=quot;Content-Typequot; content=quot;text/html;
charset=utf-8quot; />
 <title>Error</title>
</head>
<body>
   <h1>An error occurred</h1>
   <p>An error occurred; please try again later.</p>
</body>
</html>
application/models/

  A place for your quot;modelquot; code.
  I prefer to create a namespace in library that contains the
  models specific to the web application.
application/views/helpers/ &
application/views/filters/
  Custom view helpers and filters.
  Examples of Zend Framework built-in view helpers include
  formButton (for creating an XHTML form button), url (for
  creating URLs based on named routes), and htmlList (for
  generating unordered and ordered lists based on an array).
  Examples of Zend Framework built-in filters include
  HtmlEntities, StringToLower, and StringTrim.
library/

  Library code used by your web application.
  Includes Zend directory which is where Zend Framework
  lives. I usually setup this up using svn:externals.
  When setting up my own libraries I like to follow the Zend
  Framework way of setting up namespaces.
What's Next?

 More controllers and actions
 Some quot;Mquot; in MVC - Zend_Db is the next logical step for
 most web applications
 Send me an email requesting commit access to the
 example web application if you want a sandbox <bradley.
 holt@foundline.com>
Questions?

More Related Content

What's hot

Sightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVASightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVAYash Mody
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsStefano Celentano
 
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQDynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQNetcetera
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Developmentjoelabrahamsson
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentGabriel Walt
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend FrameworkPhil Brown
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
Benefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkBenefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkToby Beresford
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content RepositoryGabriel Walt
 
Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)Keshab Nath
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev TricksGabriel Walt
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniterAhmad Arif
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSGunnar Hillert
 
Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniterPiti Suwannakom
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentationsasidhar
 
Asp Net Advance Topics
Asp Net Advance TopicsAsp Net Advance Topics
Asp Net Advance TopicsAli Taki
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieOPEN KNOWLEDGE GmbH
 

What's hot (20)

Sightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVASightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVA
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling Models
 
Aem best practices
Aem best practicesAem best practices
Aem best practices
 
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQDynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Development
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Benefits of the CodeIgniter Framework
Benefits of the CodeIgniter FrameworkBenefits of the CodeIgniter Framework
Benefits of the CodeIgniter Framework
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
 
CodeIgniter 101 Tutorial
CodeIgniter 101 TutorialCodeIgniter 101 Tutorial
CodeIgniter 101 Tutorial
 
Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniter
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniter
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
Asp Net Advance Topics
Asp Net Advance TopicsAsp Net Advance Topics
Asp Net Advance Topics
 
MVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative WebtechnologieMVC 1.0 als alternative Webtechnologie
MVC 1.0 als alternative Webtechnologie
 
Advanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And ConstructsAdvanced Asp.Net Concepts And Constructs
Advanced Asp.Net Concepts And Constructs
 

Similar to Zend Framework Quick Start Walk Through

Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend FrameworkAdam Culp
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkNilesh Bangar
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questionsAkhil Mittal
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-frameworkMarcelo da Rocha
 
phpWebApp presentation
phpWebApp presentationphpWebApp presentation
phpWebApp presentationDashamir Hoxha
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...LinnAlexandra
 

Similar to Zend Framework Quick Start Walk Through (20)

Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
TomatoCMS in A Nutshell
TomatoCMS in A NutshellTomatoCMS in A Nutshell
TomatoCMS in A Nutshell
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Introduction to Zend Framework
Introduction to Zend FrameworkIntroduction to Zend Framework
Introduction to Zend Framework
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
Getting started-with-zend-framework
Getting started-with-zend-frameworkGetting started-with-zend-framework
Getting started-with-zend-framework
 
phpWebApp presentation
phpWebApp presentationphpWebApp presentation
phpWebApp presentation
 
ASP.NET lecture 8
ASP.NET lecture 8ASP.NET lecture 8
ASP.NET lecture 8
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
 
Zend framework
Zend frameworkZend framework
Zend framework
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
Php.Mvc Presentation
Php.Mvc PresentationPhp.Mvc Presentation
Php.Mvc Presentation
 
Zend framework 01 - introduction
Zend framework 01 - introductionZend framework 01 - introduction
Zend framework 01 - introduction
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 

More from Bradley Holt

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Bradley Holt
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignBradley Holt
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonBradley Holt
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchAppsBradley Holt
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignBradley Holt
 
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBBradley Holt
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsBradley Holt
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchAppsBradley Holt
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBBradley Holt
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with ApacheBradley Holt
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHPBradley Holt
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3Bradley Holt
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web ServicesBradley Holt
 

More from Bradley Holt (15)

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf Boston
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchApps
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven Design
 
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDB
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with Apache
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHP
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 

Recently uploaded

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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Zend Framework Quick Start Walk Through

  • 1. Zend Framework Quick Start Walk Through Bradley Holt <bradley.holt@foundline.com> Found Line
  • 2. Introduction Zend Framework is a quot;gluequot; framework that also provides an MVC quot;stack.quot; Provides much flexibility but quot;best practicesquot; are still sometimes hard to figure out (there are proposals that address this such as Zend_Console & Zend_Build). This presentation will focus mainly on what is suggested in Zend Framework documentation.
  • 3. Why We Chose Zend Framework Clear separation between design and development (MVC) Gives a starting point for code reuse (coding standards, namespace organization, etc.) quot;Use-at-willquot; architecture - if I don't like something I can extend or replace it Great documentation Permissive open source license (modified BSD) Doesn't hurt to have quot;The PHP Companyquot; behind it
  • 4. Resources Zend Framework installation Zend_Controller quick start Example web application on Google Code
  • 5. Installation Make sure you have PHP 5.1.4 or later (full system requirements). Download the latest stable release, download the latest nightly snapshot, or use a Subversion (SVN) client to get a copy of Zend Framework. Make sure your PHP include_path contains the path to the Zend Framework library. Zend Framework contains many components that may now be used in your web application even if you decide not to use Zend Framework MVC.
  • 6. Zend Framework MVC Overview Model - many options including Zend_Db & Zend_Service View - Zend_View Controller - Zend_Controller Zend_Controller_Front uses a Front Controller pattern. Incoming requests are dispatched to Action Controllers based on the requested URL: http://example.com http://example.com/controller http://example.com/controller /action http://example.com/controller /action /key /value
  • 7. File System Layout application/ controllers/ ErrorController.php IndexController.php models/ views/ scripts/ error/ error.phtml index/ index.phtml helpers/ filters/ html/ .htaccess index.php library/ Zend/
  • 8. html/ Your web server's document root. Contains the bootstrap file which all requests are routed through. Contains the .htaccess file which uses mod_rewrite to make sure all requests are rewritten to your bootstrap file. You can use regex so that requests for static files (e.g. js, ico, gif, jpg, png, css) are not rewritten to your bootstrap file.
  • 9. html/.htaccess RewriteEngine on RewriteRule !.(js|ico|gif|jpg|png|css)$ index.php php_value include_path ../library php_flag register_globals off php_value error_reporting 2047 php_flag display_errors on
  • 10. html/index.php (bootstrap file) <?php require_once 'Zend/Controller/Front.php'; Zend_Controller_Front::run('../application/controllers');
  • 11. application/controllers/ Contains the Action Controllers for your web application. Each of your Action Controller will extend the Zend_Controller_Action class. Each of your Action Controller class names should end in quot;Controller.quot; For example: FooController. Each Action Controller can have multiple actions represented by public functions ending in the name quot;Action.quot; For example: barAction().
  • 12. application/controllers/ IndexController.php <?php /** Zend_Controller_Action */ require_once 'Zend/Controller/Action.php'; class IndexController extends Zend_Controller_Action { public function indexAction() { } }
  • 13. application/views/scripts/ Contains the view scripts for your web application. Default extension for view scripts is .phtml. Controller name is used to match the directory and action name is used to match the view script. Given FooController::barAction() the view script would be foo/bar.phtml.
  • 14. application/views/scripts/index/ index.phtml <!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot; quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;> <html> <head> <meta http-equiv=quot;Content-Typequot; content=quot;text/html; charset=utf-8quot; /> <title>My first Zend Framework App</title> </head> <body> <h1>Hello, World!</h1> </body> </html>
  • 15. application/controllers/ ErrorController.php <?php /** Zend_Controller_Action */ require_once 'Zend/Controller/Action.php'; class ErrorController extends Zend_Controller_Action { public function errorAction() { } }
  • 16. application/views/scripts/error/ error.phtml <!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Strict//ENquot; quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtdquot;> <html> <head> <meta http-equiv=quot;Content-Typequot; content=quot;text/html; charset=utf-8quot; /> <title>Error</title> </head> <body> <h1>An error occurred</h1> <p>An error occurred; please try again later.</p> </body> </html>
  • 17. application/models/ A place for your quot;modelquot; code. I prefer to create a namespace in library that contains the models specific to the web application.
  • 18. application/views/helpers/ & application/views/filters/ Custom view helpers and filters. Examples of Zend Framework built-in view helpers include formButton (for creating an XHTML form button), url (for creating URLs based on named routes), and htmlList (for generating unordered and ordered lists based on an array). Examples of Zend Framework built-in filters include HtmlEntities, StringToLower, and StringTrim.
  • 19. library/ Library code used by your web application. Includes Zend directory which is where Zend Framework lives. I usually setup this up using svn:externals. When setting up my own libraries I like to follow the Zend Framework way of setting up namespaces.
  • 20. What's Next? More controllers and actions Some quot;Mquot; in MVC - Zend_Db is the next logical step for most web applications Send me an email requesting commit access to the example web application if you want a sandbox <bradley. holt@foundline.com>