SlideShare a Scribd company logo
Head First Zend Framework
       Part 1 - Project & Application

                               Jace Ju
Install
   Get Zend Framework from svn repository.
# cd /path/to/library/php

# svn co http://framework.zend.com/svn/framework/standard/tags/release-
1.10.x/library/Zend

(add ZF_HOME = /path/to/ZF, example: /usr/local/ZF)

# cd $ZF_HOME

# svn co http://framework.zend.com/svn/framework/standard/tags/release-1.10.x/bin

# cd bin

# ln –s $ZF_HOME/bin/zf.sh $ZF_HOME/bin/zf
Setup
   Create config of zf script
# zf create config
Successfully written Zend Tool config.
It is located at: /usr/local/ZF/.zf.ini

(Bug in ZF 1.10.6.)
# vi /usr/local/ZF/.zf.ini
php.includepath change to php.include_path

# zf show config
User Configuration: /usr/local/ZF/.zf.ini
  `-- php
      `-- include_path: /usr/local/lib/php:/var/lib/php:.
What is zf script
   Help info
# zf ?
Usage:
    zf [--global-opts] action-name [--action-opts] provider-name [--provider-opts]
[provider parameters ...]
    Note: You may use "?" in any place of the above usage string to ask for more
specific help information.
    Example: "zf ? version" will list all available actions for the version provider.

... (ignore) ...

DbTable
    zf create db-table name actual-table-name module force-overwrite
    Note: There are specialties, use zf create db-table.? to get specific help on
them.

    ProjectProvider
      zf create project-provider name actions
Create Project
   Build a project skeleton
# cd /path/to/wwwroot

# zf create project zf_test
Creating project at /path/to/wwwroot/zf_test
Note: This command created a web project, for more information setting up your VHOST,
please see docs/README

# cd /path/to/wwwroot/zf_test

# zf show project.info
Working with project located at: /path/to/wwwroot/zf_test

# zf show profile
ProjectDirectory
    ProjectProfileFile
    ... (ignore) ...
    TestsDirectory
        TestPHPUnitConfigFile
        TestApplicationDirectory
            TestApplicationBootstrapFile
        TestLibraryDirectory
            TestLibraryBootstrapFile
Setup Project
   Setup VirtualHost in Apache config file
<VirtualHost *:80>
   DocumentRoot "/path/to/wwwroot/zf_test/public"
   ServerName zf_test

    # This should be omitted in the production environment
    SetEnv APPLICATION_ENV development

    <Directory "/path/to/wwwroot/zf_test/public">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>



   http://zf_test/
Create Protable Project
   Change position of index.php and .htaccess
# cd /path/to/wwwroot/zf_test

# cp public/.htaccess .

# cp public/index.php .

# vi public/.htaccess
RewriteEngine Off

# vi public/index.php
<?php
header('HTTP/1.1 403 Forbidden');

# vi .htaccess
SetEnv APPLICATION_ENV development

# vi index.php
'/../application' change to '/application'



   http://localhost/zf_test/
Project Structure
   application
       configs
       controllers
       models
       views
           helpers
           scripts
   docs
   library
   public
   tests
Application
   Zend_Application
   Zend_Application_Bootstrap
   Zend_Application_Resource
Zend_Application
   Load Configuration.
   Initialize bootstrap.
   Run.
# cd /path/to/wwwroot/zf_test

# vi index.php
... (ignore) ...

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();
application.ini
   Configuration section.
# cd /path/to/wwwroot/zf_test

# vi application/configs/application.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
phpSettings in application.ini
   Use "ini_set" function.
   See http://www.php.net/manual/en/ini.list.php.
includePaths in application.ini
   Use "set_include_path" function.
   Prepend to "include_path".
   "library" is identity for configuration.
bootstrap in application.ini
   To load Bootstrap class.
Zend_Application_Bootstrap
   Initialize custom resources for project.
# cd /path/to/wwwroot/zf_test

# vi application/Bootstrap.php
<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initResource1()
    {
        $this->bootstrap('resource2'); // Initialize Resource 2 first.
        echo "Initialize Resource 1n";
    }

     protected function _initResource2()
     {
         echo "Initialize Resource 2n ";
     }
}
appnamespace in application.ini
   Define the autoloader prefix of models, form,
    etc.
resources in application.ini
   Load common resources.
   Define resource options.
FrontController Resource
   Initialize Front Controller.
   frontController.controllerdirectory
       call Zend_Controller_Front::setControllerDirectory()
   frontController.params
       call Zend_Controller_Front::setParams()
Zend_Application_Resource
   Common Resources
       Front Controller
       Router
       Database
       View
       Session
       Layout
       Log
       ...
   More flexible then Bootstrap::_init<Resource>
    method.
Example: Database Resource
   Initialize Custom Resources for Project
# cd /path/to/wwwroot/zf_test

# zf configure db-adapter "adapter=mysqli&username=uname&password=mypass&dbname=mydb"
A db configuration for the production section has been written to the application
config file.

# vi application/configs/application.ini
[production]
... (ignore) ...
resources.db.adapter = "mysqli"
resources.db.params.username = "uname"
resources.db.params.password = "mypass"
resources.db.params.dbname = "mydb"

... (ignore) ...




   Will initialize Zend_Application_Resource_Db
Autoloadernamespaces in application.ini
   Register the prefix of library.
Autoloadernamespaces[] = "My_"
pluginPaths in application.ini
   Register the prefix and path of plugin classes.
   Resolve loading order of plugin.
pluginPaths.My_Application_Resource_ = "My/Application/Resource"
Summary
   Zend_Application
       Load configuration.
       Set bootstrap and run.
   Zend_Application_Bootstrap
       Initialize resources.
   Zend_Application_Resource
       Get options from configuration.
       Initialize controller, view, database, etc.
See you next part.

More Related Content

What's hot

Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Caldera Labs
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
Caldera Labs
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
Caldera Labs
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework Components
Abdul Malik Ikhsan
 
Reusable bootstrap resources zend con 2010
Reusable bootstrap resources   zend con 2010Reusable bootstrap resources   zend con 2010
Reusable bootstrap resources zend con 2010
Hector Virgen
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
Alexey Popravka
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkMichael Peacock
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 
Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
Santosh Ghimire
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
mirahman
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
Gary Hockin
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
 
Complex Sites with Silex
Complex Sites with SilexComplex Sites with Silex
Complex Sites with Silex
Chris Tankersley
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)
andrewnacin
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mind
Valentine Matsveiko
 

What's hot (20)

Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework Components
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
Reusable bootstrap resources zend con 2010
Reusable bootstrap resources   zend con 2010Reusable bootstrap resources   zend con 2010
Reusable bootstrap resources zend con 2010
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 
Phinx talk
Phinx talkPhinx talk
Phinx talk
 
Kyiv.py #17 Flask talk
Kyiv.py #17 Flask talkKyiv.py #17 Flask talk
Kyiv.py #17 Flask talk
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
ACL in CodeIgniter
ACL in CodeIgniterACL in CodeIgniter
ACL in CodeIgniter
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
 
Complex Sites with Silex
Complex Sites with SilexComplex Sites with Silex
Complex Sites with Silex
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mind
 

Similar to Head First Zend Framework - Part 1 Project & Application

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
Gordon Forsythe
 
Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend framework
Saidur Rahman
 
Introduction to Zend framework
Introduction to Zend framework Introduction to Zend framework
Introduction to Zend framework
Matteo Magni
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Maven
MavenMaven
Maven
javeed_mhd
 
Maven
MavenMaven
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
Anand kalla
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
Deepak Garg
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
Fabien Doiron
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
Bo-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 2011
Michelangelo van Dam
 
Scaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R MunteanuScaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R Munteanu
mfrancis
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
Robert Munteanu
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
Adam Culp
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
Paul Jones
 

Similar to Head First Zend Framework - Part 1 Project & Application (20)

Zend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_ToolZend Framework 1.9 Setup & Using Zend_Tool
Zend Framework 1.9 Setup & Using Zend_Tool
 
Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend framework
 
Getting up and running with Zend Framework
Getting up and running with Zend FrameworkGetting up and running with Zend Framework
Getting up and running with Zend Framework
 
Introduction to Zend framework
Introduction to Zend framework Introduction to Zend framework
Introduction to Zend framework
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
 
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
 
Scaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R MunteanuScaling up development of a modular code base - R Munteanu
Scaling up development of a modular code base - R Munteanu
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
Foundations of Zend Framework
Foundations of Zend FrameworkFoundations of Zend Framework
Foundations of Zend Framework
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Maven
MavenMaven
Maven
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
 

More from Jace Ju

Advanced php testing in action
Advanced php testing in actionAdvanced php testing in action
Advanced php testing in action
Jace Ju
 
Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnitJace Ju
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVCJace Ju
 
如何打造 WebMVC Framework - 基礎概念篇
如何打造 WebMVC Framework - 基礎概念篇如何打造 WebMVC Framework - 基礎概念篇
如何打造 WebMVC Framework - 基礎概念篇Jace Ju
 
Refactoring with Patterns in PHP
Refactoring with Patterns in PHPRefactoring with Patterns in PHP
Refactoring with Patterns in PHP
Jace Ju
 
Patterns in Library Design (套件設計裡的模式)
Patterns in Library Design (套件設計裡的模式)Patterns in Library Design (套件設計裡的模式)
Patterns in Library Design (套件設計裡的模式)
Jace Ju
 
購物車程式架構簡介
購物車程式架構簡介購物車程式架構簡介
購物車程式架構簡介
Jace Ju
 
Patterns in Zend Framework
Patterns in Zend FrameworkPatterns in Zend Framework
Patterns in Zend FrameworkJace Ju
 
常見設計模式介紹
常見設計模式介紹常見設計模式介紹
常見設計模式介紹
Jace Ju
 
PHPUnit 入門介紹
PHPUnit 入門介紹PHPUnit 入門介紹
PHPUnit 入門介紹
Jace Ju
 
Web Refactoring
Web RefactoringWeb Refactoring
Web Refactoring
Jace Ju
 
jQuery 實戰經驗講座
jQuery 實戰經驗講座jQuery 實戰經驗講座
jQuery 實戰經驗講座
Jace Ju
 
CSS 排版 - 基礎觀念篇
CSS 排版 - 基礎觀念篇CSS 排版 - 基礎觀念篇
CSS 排版 - 基礎觀念篇
Jace Ju
 
PHP 防駭 - 基礎觀念篇
PHP 防駭 - 基礎觀念篇PHP 防駭 - 基礎觀念篇
PHP 防駭 - 基礎觀念篇
Jace Ju
 
PHP 物件導向 - 基礎觀念篇
PHP 物件導向 - 基礎觀念篇PHP 物件導向 - 基礎觀念篇
PHP 物件導向 - 基礎觀念篇
Jace Ju
 

More from Jace Ju (15)

Advanced php testing in action
Advanced php testing in actionAdvanced php testing in action
Advanced php testing in action
 
Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnit
 
深入淺出 MVC
深入淺出 MVC深入淺出 MVC
深入淺出 MVC
 
如何打造 WebMVC Framework - 基礎概念篇
如何打造 WebMVC Framework - 基礎概念篇如何打造 WebMVC Framework - 基礎概念篇
如何打造 WebMVC Framework - 基礎概念篇
 
Refactoring with Patterns in PHP
Refactoring with Patterns in PHPRefactoring with Patterns in PHP
Refactoring with Patterns in PHP
 
Patterns in Library Design (套件設計裡的模式)
Patterns in Library Design (套件設計裡的模式)Patterns in Library Design (套件設計裡的模式)
Patterns in Library Design (套件設計裡的模式)
 
購物車程式架構簡介
購物車程式架構簡介購物車程式架構簡介
購物車程式架構簡介
 
Patterns in Zend Framework
Patterns in Zend FrameworkPatterns in Zend Framework
Patterns in Zend Framework
 
常見設計模式介紹
常見設計模式介紹常見設計模式介紹
常見設計模式介紹
 
PHPUnit 入門介紹
PHPUnit 入門介紹PHPUnit 入門介紹
PHPUnit 入門介紹
 
Web Refactoring
Web RefactoringWeb Refactoring
Web Refactoring
 
jQuery 實戰經驗講座
jQuery 實戰經驗講座jQuery 實戰經驗講座
jQuery 實戰經驗講座
 
CSS 排版 - 基礎觀念篇
CSS 排版 - 基礎觀念篇CSS 排版 - 基礎觀念篇
CSS 排版 - 基礎觀念篇
 
PHP 防駭 - 基礎觀念篇
PHP 防駭 - 基礎觀念篇PHP 防駭 - 基礎觀念篇
PHP 防駭 - 基礎觀念篇
 
PHP 物件導向 - 基礎觀念篇
PHP 物件導向 - 基礎觀念篇PHP 物件導向 - 基礎觀念篇
PHP 物件導向 - 基礎觀念篇
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 

Head First Zend Framework - Part 1 Project & Application

  • 1. Head First Zend Framework Part 1 - Project & Application Jace Ju
  • 2. Install  Get Zend Framework from svn repository. # cd /path/to/library/php # svn co http://framework.zend.com/svn/framework/standard/tags/release- 1.10.x/library/Zend (add ZF_HOME = /path/to/ZF, example: /usr/local/ZF) # cd $ZF_HOME # svn co http://framework.zend.com/svn/framework/standard/tags/release-1.10.x/bin # cd bin # ln –s $ZF_HOME/bin/zf.sh $ZF_HOME/bin/zf
  • 3. Setup  Create config of zf script # zf create config Successfully written Zend Tool config. It is located at: /usr/local/ZF/.zf.ini (Bug in ZF 1.10.6.) # vi /usr/local/ZF/.zf.ini php.includepath change to php.include_path # zf show config User Configuration: /usr/local/ZF/.zf.ini `-- php `-- include_path: /usr/local/lib/php:/var/lib/php:.
  • 4. What is zf script  Help info # zf ? Usage: zf [--global-opts] action-name [--action-opts] provider-name [--provider-opts] [provider parameters ...] Note: You may use "?" in any place of the above usage string to ask for more specific help information. Example: "zf ? version" will list all available actions for the version provider. ... (ignore) ... DbTable zf create db-table name actual-table-name module force-overwrite Note: There are specialties, use zf create db-table.? to get specific help on them. ProjectProvider zf create project-provider name actions
  • 5. Create Project  Build a project skeleton # cd /path/to/wwwroot # zf create project zf_test Creating project at /path/to/wwwroot/zf_test Note: This command created a web project, for more information setting up your VHOST, please see docs/README # cd /path/to/wwwroot/zf_test # zf show project.info Working with project located at: /path/to/wwwroot/zf_test # zf show profile ProjectDirectory ProjectProfileFile ... (ignore) ... TestsDirectory TestPHPUnitConfigFile TestApplicationDirectory TestApplicationBootstrapFile TestLibraryDirectory TestLibraryBootstrapFile
  • 6. Setup Project  Setup VirtualHost in Apache config file <VirtualHost *:80> DocumentRoot "/path/to/wwwroot/zf_test/public" ServerName zf_test # This should be omitted in the production environment SetEnv APPLICATION_ENV development <Directory "/path/to/wwwroot/zf_test/public"> Options Indexes MultiViews FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>  http://zf_test/
  • 7. Create Protable Project  Change position of index.php and .htaccess # cd /path/to/wwwroot/zf_test # cp public/.htaccess . # cp public/index.php . # vi public/.htaccess RewriteEngine Off # vi public/index.php <?php header('HTTP/1.1 403 Forbidden'); # vi .htaccess SetEnv APPLICATION_ENV development # vi index.php '/../application' change to '/application'  http://localhost/zf_test/
  • 8. Project Structure  application  configs  controllers  models  views  helpers  scripts  docs  library  public  tests
  • 9. Application  Zend_Application  Zend_Application_Bootstrap  Zend_Application_Resource
  • 10. Zend_Application  Load Configuration.  Initialize bootstrap.  Run. # cd /path/to/wwwroot/zf_test # vi index.php ... (ignore) ... // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap() ->run();
  • 11. application.ini  Configuration section. # cd /path/to/wwwroot/zf_test # vi application/configs/application.ini [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.params.displayExceptions = 0 [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1
  • 12. phpSettings in application.ini  Use "ini_set" function.  See http://www.php.net/manual/en/ini.list.php.
  • 13. includePaths in application.ini  Use "set_include_path" function.  Prepend to "include_path".  "library" is identity for configuration.
  • 14. bootstrap in application.ini  To load Bootstrap class.
  • 15. Zend_Application_Bootstrap  Initialize custom resources for project. # cd /path/to/wwwroot/zf_test # vi application/Bootstrap.php <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initResource1() { $this->bootstrap('resource2'); // Initialize Resource 2 first. echo "Initialize Resource 1n"; } protected function _initResource2() { echo "Initialize Resource 2n "; } }
  • 16. appnamespace in application.ini  Define the autoloader prefix of models, form, etc.
  • 17. resources in application.ini  Load common resources.  Define resource options.
  • 18. FrontController Resource  Initialize Front Controller.  frontController.controllerdirectory  call Zend_Controller_Front::setControllerDirectory()  frontController.params  call Zend_Controller_Front::setParams()
  • 19. Zend_Application_Resource  Common Resources  Front Controller  Router  Database  View  Session  Layout  Log  ...  More flexible then Bootstrap::_init<Resource> method.
  • 20. Example: Database Resource  Initialize Custom Resources for Project # cd /path/to/wwwroot/zf_test # zf configure db-adapter "adapter=mysqli&username=uname&password=mypass&dbname=mydb" A db configuration for the production section has been written to the application config file. # vi application/configs/application.ini [production] ... (ignore) ... resources.db.adapter = "mysqli" resources.db.params.username = "uname" resources.db.params.password = "mypass" resources.db.params.dbname = "mydb" ... (ignore) ...  Will initialize Zend_Application_Resource_Db
  • 21. Autoloadernamespaces in application.ini  Register the prefix of library. Autoloadernamespaces[] = "My_"
  • 22. pluginPaths in application.ini  Register the prefix and path of plugin classes.  Resolve loading order of plugin. pluginPaths.My_Application_Resource_ = "My/Application/Resource"
  • 23. Summary  Zend_Application  Load configuration.  Set bootstrap and run.  Zend_Application_Bootstrap  Initialize resources.  Zend_Application_Resource  Get options from configuration.  Initialize controller, view, database, etc.
  • 24. See you next part.