SlideShare una empresa de Scribd logo
1 de 37
Zend Framework
• What is Zend Framework?

• Getting and Installing Zend
  Framework

• MVC overview

• Quick Start to developing
  applications using Zend
  Framework's
What is Zend Framework?
•    PHP 5 library for web development
     productivity

•    Free, Open source


•    Class library – fully OOP

•    Documentation – in many languages


•    Quality & testing – fully unit tested
What's in Zend Framework?
Requirments

•    PHP 5.1.4


•    Web server

•    Standard installation


•    Commonly no additional extensions needed
quickstart
             quickstart
The         |-- application
             |-- application
            || |-- Bootstrap.php
                 |-- Bootstrap.php
            || |-- configs
                 |-- configs
            || || `-- application.ini
directory            `-- application.ini
            || |-- controllers
                 |-- controllers
            || || |-- ErrorController.php
                     |-- ErrorController.php
            || || `-- IndexController.php
                     `-- IndexController.php
tree        || |-- models
                 |-- models
            || `-- views
            ||
                 `-- views
                    |-- helpers
                     |-- helpers
            ||      `-- scripts
                     `-- scripts
            ||           |-- error
                          |-- error
            ||           || `-- error.phtml
                              `-- error.phtml
            ||           `-- index
                          `-- index
            ||               `-- index.phtml
                              `-- index.phtml
            |-- library
             |-- library
            |-- public
             |-- public
            || `-- index.php
                 `-- index.php
            `-- tests
             `-- tests
                |-- application
                 |-- application
                || `-- bootstrap.php
                     `-- bootstrap.php
                |-- library
                 |-- library
                || `-- bootstrap.php
                     `-- bootstrap.php
                `-- phpunit.xml
                 `-- phpunit.xml
            14 directories, 10 files
             14 directories, 10 files
Sample INI config
[production]
 [production]
app.name = "Foo!"
 app.name = "Foo!"
db.adapter = "Pdo_Mysql"
 db.adapter = "Pdo_Mysql"
db.params.username = "foo"
 db.params.username = "foo"
db.params.password = "bar"
 db.params.password = "bar"
db.params.dbname = "foodb"
 db.params.dbname = "foodb"
db.params.host = "127.0.0.1"
 db.params.host = "127.0.0.1"
[testing : production]
 [testing : production]
db.adapter = "Pdo_Sqlite"
 db.adapter = "Pdo_Sqlite"
db.params.dbname = APPLICATION_PATH "/data/test.db"
 db.params.dbname = APPLICATION_PATH "/data/test.db"
Getting and
   Installing
Zend Framework
Always found at:
http://framework.zend.com
     /download/latest
Unzip/Untar

• Use CLI:
  % tar xzf ZendFramework-1.9.2-
  minimal.tar.gz
  % unzip ZendFramework-1.9.2-
  minimal.zip
• Or use a GUI file manager
Add to your
include_path
 <?php
  <?php
 set_include_path(implode(PATH_SEPARATOR, array(
  set_include_path(implode(PATH_SEPARATOR, array(
     '.',
       '.',
     '/home/matthew/zf/library',
       '/home/matthew/zf/library',
     get_include_path(),
       get_include_path(),
 )));
  )));
Step 1:
Create the project
Locate the zfModel in the Controller
  Using the utility
 In bin/zf.sh of bin/zf.bat of your ZF install
  (choose based on your OS)
 Place bin/ in your path, or create an alias on
  your path:
  alias zf=/path/to/bin/zf.sh
Create the project

    # Unix:
     # Unix:
    % zf.sh create project quickstart
     % zf.sh create project quickstart
    # DOS/Windows:
     # DOS/Windows:
    C:> zf.bat create project quickstart
     C:> zf.bat create project quickstart
Create a vhost
<VirtualHost *:80>
 <VirtualHost *:80>
    ServerAdmin you@atyour.tld
     ServerAdmin you@atyour.tld
    DocumentRoot /abs/path/to/quickstart/public
     DocumentRoot /abs/path/to/quickstart/public
    ServerName quickstart
     ServerName quickstart
    <Directory /abs/path/to/quickstart/public>
     <Directory /abs/path/to/quickstart/public>
        DirectoryIndex index.php
         DirectoryIndex index.php
        AllowOverride All
         AllowOverride All
        Order allow,deny
         Order allow,deny
        Allow from all
         Allow from all
    </Directory>
     </Directory>
</VirtualHost>
 </VirtualHost>
Fire up your browser!
Configuration
 [production]
  [production]
 phpSettings.display_startup_errors == 00
  phpSettings.display_startup_errors
 phpSettings.display_errors == 00
  phpSettings.display_errors
 includePaths.library == APPLICATION_PATH "/../library"
  includePaths.library    APPLICATION_PATH "/../library"
 bootstrap.path == APPLICATION_PATH "/Bootstrap.php"
  bootstrap.path    APPLICATION_PATH "/Bootstrap.php"
 bootstrap.class == "Bootstrap"
  bootstrap.class    "Bootstrap"
 resources.frontController.controllerDirectory ==
  resources.frontController.controllerDirectory
     APPLICATION_PATH "/controllers"
      APPLICATION_PATH "/controllers"
 [staging :: production]
  [staging    production]
 [testing :: production]
  [testing    production]
 phpSettings.display_startup_errors == 11
  phpSettings.display_startup_errors
 phpSettings.display_errors == 11
  phpSettings.display_errors
 [development :: production]
  [development    production]
 phpSettings.display_startup_errors == 11
  phpSettings.display_startup_errors
 phpSettings.display_errors == 11
  phpSettings.display_errors
.htaccess file

   SetEnv APPLICATION_ENV development
    SetEnv APPLICATION_ENV development
   RewriteEngine On
    RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -s [OR]
   RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
   RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
Step 2:
Create a controller
Create a controller
All controllers extend
 Zend_Controller_Action
Naming conventions

   Controllers end with 'Controller':
    IndexController, GuestbookController

   Action methods end with 'Action':
    signAction(), displayAction(), listAction()

  Controllers should be in the
   application/controllers/ directory, and named
   after the class, with a “.php” suffix:

  application/controllers/IndexController.php
IndexController.php
Step 3:
Create the model
Using the Model in the Controller
Using the Model in the Controller
•   Controller needs to retrieve Model
•   To start, let's fetch listings
Using the Model in the Controller
Adding the Model to the Controller
Using the Model in the Controller
Table Module – Access Methods
Step 4:
Create views
Create a view
         Create a view script
•    View scripts go in application/views/scripts/
•    View script resolution looks for a view script
     in a subdirectory named after the controller
    – Controller name used is same as it appears on the
      url:
       • “GuestbookController” appears on the URL as
         “guestbook”
•    View script name is the action name as it
     appears on the url:
•       “signAction()” appears on the URL as “sign”
index/index.phtml view script
Step 5:
Create a form
Create a Form

Zend_Form:

• Flexible form generations
• Element validation and filtering
• Rendering
      View helper to render element
    Decorators for labels and HTML wrappers
• Optional Zend_Config configuraion
Create a form – Identify elements
Guestbook form:
• Email address
• Comment
• Captcha to reduce spam entries
• Submit button
Create a form – Guestbook form
Using the Form in the Controller
• Controller needs to fetch form object
• On landing page, display the form
• On POST requests, attempt to validate the
  form
• On successful submission, redirect
Adding the form to the controller
Step 6:
Create a layout
Layouts
• We want our application views to appear in
  this:
Thank you.

Más contenido relacionado

La actualidad más candente

More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHPPer Bernhardt
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with RackDonSchado
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budgetDavid Lukac
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Vikas Chauhan
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP ApplicationsPavan Kumar N
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with PhingMichiel Rook
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Using Test Kitchen for testing Chef cookbooks
Using Test Kitchen for testing Chef cookbooksUsing Test Kitchen for testing Chef cookbooks
Using Test Kitchen for testing Chef cookbooksTimur Batyrshin
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webWallace Reis
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2Per Bernhardt
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance毅 吕
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012D
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015Colin O'Dell
 

La actualidad más candente (20)

More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHP
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
Automatisation in development and testing - within budget
Automatisation in development and testing - within budgetAutomatisation in development and testing - within budget
Automatisation in development and testing - within budget
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
 
Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Using Test Kitchen for testing Chef cookbooks
Using Test Kitchen for testing Chef cookbooksUsing Test Kitchen for testing Chef cookbooks
Using Test Kitchen for testing Chef cookbooks
 
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento webA reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
 
Composer
ComposerComposer
Composer
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2
 
Sprockets
SprocketsSprockets
Sprockets
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015
 
はじめてのSymfony2
はじめてのSymfony2はじめてのSymfony2
はじめてのSymfony2
 
Rails 4.0
Rails 4.0Rails 4.0
Rails 4.0
 

Similar a Zend Framework

Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend FrameworkPhil Brown
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
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
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_companyGanesh Kulkarni
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Software, Inc.
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Michelangelo van Dam
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 Makoto Kaga
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Michelangelo van Dam
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023Mark Niebergall
 
Introduction to Codeigniter
Introduction to Codeigniter Introduction to Codeigniter
Introduction to Codeigniter Zero Huang
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeCybera Inc.
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastMichelangelo van Dam
 
Virtual Environment and Web development using Django
Virtual Environment and Web development using DjangoVirtual Environment and Web development using Django
Virtual Environment and Web development using DjangoSunil kumar Mohanty
 

Similar a Zend Framework (20)

Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
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
 
Edp bootstrapping a-software_company
Edp bootstrapping a-software_companyEdp bootstrapping a-software_company
Edp bootstrapping a-software_company
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
 
Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012Quality Assurance for PHP projects - ZendCon 2012
Quality Assurance for PHP projects - ZendCon 2012
 
Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013Workshop quality assurance for php projects - ZendCon 2013
Workshop quality assurance for php projects - ZendCon 2013
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023Filesystem Management with Flysystem at PHP UK 2023
Filesystem Management with Flysystem at PHP UK 2023
 
Bake by cake php2.0
Bake by cake php2.0Bake by cake php2.0
Bake by cake php2.0
 
Introduction to Codeigniter
Introduction to Codeigniter Introduction to Codeigniter
Introduction to Codeigniter
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
 
Virtual Environment and Web development using Django
Virtual Environment and Web development using DjangoVirtual Environment and Web development using Django
Virtual Environment and Web development using Django
 

Más de OpenSource Technologies Pvt. Ltd. (13)

OpenSource Technologies Portfolio
OpenSource Technologies PortfolioOpenSource Technologies Portfolio
OpenSource Technologies Portfolio
 
Cloud Computing Amazon
Cloud Computing AmazonCloud Computing Amazon
Cloud Computing Amazon
 
Empower your business with joomla
Empower your business with joomlaEmpower your business with joomla
Empower your business with joomla
 
Responsive Web Design Fundamentals
Responsive Web Design FundamentalsResponsive Web Design Fundamentals
Responsive Web Design Fundamentals
 
MySQL Training
MySQL TrainingMySQL Training
MySQL Training
 
PHP Shield - The PHP Encoder
PHP Shield - The PHP EncoderPHP Shield - The PHP Encoder
PHP Shield - The PHP Encoder
 
Introduction to Ubantu
Introduction to UbantuIntroduction to Ubantu
Introduction to Ubantu
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Plugins
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Asp.net
Asp.netAsp.net
Asp.net
 
OST Profile
OST ProfileOST Profile
OST Profile
 

Último

How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Último (20)

How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

Zend Framework

  • 2. • What is Zend Framework? • Getting and Installing Zend Framework • MVC overview • Quick Start to developing applications using Zend Framework's
  • 3. What is Zend Framework? • PHP 5 library for web development productivity • Free, Open source • Class library – fully OOP • Documentation – in many languages • Quality & testing – fully unit tested
  • 4. What's in Zend Framework?
  • 5. Requirments • PHP 5.1.4 • Web server • Standard installation • Commonly no additional extensions needed
  • 6. quickstart quickstart The |-- application |-- application || |-- Bootstrap.php |-- Bootstrap.php || |-- configs |-- configs || || `-- application.ini directory `-- application.ini || |-- controllers |-- controllers || || |-- ErrorController.php |-- ErrorController.php || || `-- IndexController.php `-- IndexController.php tree || |-- models |-- models || `-- views || `-- views |-- helpers |-- helpers || `-- scripts `-- scripts || |-- error |-- error || || `-- error.phtml `-- error.phtml || `-- index `-- index || `-- index.phtml `-- index.phtml |-- library |-- library |-- public |-- public || `-- index.php `-- index.php `-- tests `-- tests |-- application |-- application || `-- bootstrap.php `-- bootstrap.php |-- library |-- library || `-- bootstrap.php `-- bootstrap.php `-- phpunit.xml `-- phpunit.xml 14 directories, 10 files 14 directories, 10 files
  • 7. Sample INI config [production] [production] app.name = "Foo!" app.name = "Foo!" db.adapter = "Pdo_Mysql" db.adapter = "Pdo_Mysql" db.params.username = "foo" db.params.username = "foo" db.params.password = "bar" db.params.password = "bar" db.params.dbname = "foodb" db.params.dbname = "foodb" db.params.host = "127.0.0.1" db.params.host = "127.0.0.1" [testing : production] [testing : production] db.adapter = "Pdo_Sqlite" db.adapter = "Pdo_Sqlite" db.params.dbname = APPLICATION_PATH "/data/test.db" db.params.dbname = APPLICATION_PATH "/data/test.db"
  • 8. Getting and Installing Zend Framework
  • 10. Unzip/Untar • Use CLI: % tar xzf ZendFramework-1.9.2- minimal.tar.gz % unzip ZendFramework-1.9.2- minimal.zip • Or use a GUI file manager
  • 11. Add to your include_path <?php <?php set_include_path(implode(PATH_SEPARATOR, array( set_include_path(implode(PATH_SEPARATOR, array( '.', '.', '/home/matthew/zf/library', '/home/matthew/zf/library', get_include_path(), get_include_path(), ))); )));
  • 13. Locate the zfModel in the Controller Using the utility  In bin/zf.sh of bin/zf.bat of your ZF install (choose based on your OS)  Place bin/ in your path, or create an alias on your path: alias zf=/path/to/bin/zf.sh
  • 14. Create the project # Unix: # Unix: % zf.sh create project quickstart % zf.sh create project quickstart # DOS/Windows: # DOS/Windows: C:> zf.bat create project quickstart C:> zf.bat create project quickstart
  • 15. Create a vhost <VirtualHost *:80> <VirtualHost *:80> ServerAdmin you@atyour.tld ServerAdmin you@atyour.tld DocumentRoot /abs/path/to/quickstart/public DocumentRoot /abs/path/to/quickstart/public ServerName quickstart ServerName quickstart <Directory /abs/path/to/quickstart/public> <Directory /abs/path/to/quickstart/public> DirectoryIndex index.php DirectoryIndex index.php AllowOverride All AllowOverride All Order allow,deny Order allow,deny Allow from all Allow from all </Directory> </Directory> </VirtualHost> </VirtualHost>
  • 16. Fire up your browser!
  • 17. Configuration [production] [production] phpSettings.display_startup_errors == 00 phpSettings.display_startup_errors phpSettings.display_errors == 00 phpSettings.display_errors includePaths.library == APPLICATION_PATH "/../library" includePaths.library APPLICATION_PATH "/../library" bootstrap.path == APPLICATION_PATH "/Bootstrap.php" bootstrap.path APPLICATION_PATH "/Bootstrap.php" bootstrap.class == "Bootstrap" bootstrap.class "Bootstrap" resources.frontController.controllerDirectory == resources.frontController.controllerDirectory APPLICATION_PATH "/controllers" APPLICATION_PATH "/controllers" [staging :: production] [staging production] [testing :: production] [testing production] phpSettings.display_startup_errors == 11 phpSettings.display_startup_errors phpSettings.display_errors == 11 phpSettings.display_errors [development :: production] [development production] phpSettings.display_startup_errors == 11 phpSettings.display_startup_errors phpSettings.display_errors == 11 phpSettings.display_errors
  • 18. .htaccess file SetEnv APPLICATION_ENV development SetEnv APPLICATION_ENV development RewriteEngine On RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] RewriteRule ^.*$ index.php [NC,L]
  • 19. Step 2: Create a controller
  • 20. Create a controller All controllers extend Zend_Controller_Action Naming conventions  Controllers end with 'Controller': IndexController, GuestbookController  Action methods end with 'Action': signAction(), displayAction(), listAction() Controllers should be in the application/controllers/ directory, and named after the class, with a “.php” suffix: application/controllers/IndexController.php
  • 23. Using the Model in the Controller Using the Model in the Controller • Controller needs to retrieve Model • To start, let's fetch listings
  • 24. Using the Model in the Controller Adding the Model to the Controller
  • 25. Using the Model in the Controller Table Module – Access Methods
  • 27. Create a view Create a view script • View scripts go in application/views/scripts/ • View script resolution looks for a view script in a subdirectory named after the controller – Controller name used is same as it appears on the url: • “GuestbookController” appears on the URL as “guestbook” • View script name is the action name as it appears on the url: • “signAction()” appears on the URL as “sign”
  • 30. Create a Form Zend_Form: • Flexible form generations • Element validation and filtering • Rendering View helper to render element Decorators for labels and HTML wrappers • Optional Zend_Config configuraion
  • 31. Create a form – Identify elements Guestbook form: • Email address • Comment • Captcha to reduce spam entries • Submit button
  • 32. Create a form – Guestbook form
  • 33. Using the Form in the Controller • Controller needs to fetch form object • On landing page, display the form • On POST requests, attempt to validate the form • On successful submission, redirect
  • 34. Adding the form to the controller
  • 36. Layouts • We want our application views to appear in this: