SlideShare uma empresa 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.

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante 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
 

Semelhante 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
 

Mais 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

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
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
 

Último (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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...
 

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: