Submit Search
Upload
Zend Framework 2 Documentation: Getting Started Guide
•
2 likes
•
2,849 views
AI-enhanced title
Sridhar Mantha
Follow
zend pdf document
Read less
Read more
Self Improvement
Report
Share
Report
Share
1 of 1659
Download now
Download to read offline
Recommended
Zend framework tutorial
Zend framework tutorial
Olsi Zotaj
Db2 virtualization
Db2 virtualization
bupbechanhgmail
The maxima book
The maxima book
ssuser0efdb21
Virtual box documentação tecnica
Virtual box documentação tecnica
ALEXANDRE MEDINA
Redp4469
Redp4469
Ambresh Kothand
Oracle VM VirtualBox User Manual
Oracle VM VirtualBox User Manual
MAIS Business Solutions
Os linux complete notes
Os linux complete notes
Dreams Design
EMC NetWorker Module for Microsoft SQL Server Release 5.1 ...
EMC NetWorker Module for Microsoft SQL Server Release 5.1 ...
webhostingguy
Recommended
Zend framework tutorial
Zend framework tutorial
Olsi Zotaj
Db2 virtualization
Db2 virtualization
bupbechanhgmail
The maxima book
The maxima book
ssuser0efdb21
Virtual box documentação tecnica
Virtual box documentação tecnica
ALEXANDRE MEDINA
Redp4469
Redp4469
Ambresh Kothand
Oracle VM VirtualBox User Manual
Oracle VM VirtualBox User Manual
MAIS Business Solutions
Os linux complete notes
Os linux complete notes
Dreams Design
EMC NetWorker Module for Microsoft SQL Server Release 5.1 ...
EMC NetWorker Module for Microsoft SQL Server Release 5.1 ...
webhostingguy
AIX 5L Differences Guide Version 5.3 Edition
AIX 5L Differences Guide Version 5.3 Edition
IBM India Smarter Computing
Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0
Muhaza Liebenlito
Implementing IBM SmartCloud Entry on IBM PureFlex System
Implementing IBM SmartCloud Entry on IBM PureFlex System
IBM India Smarter Computing
R installation and administration
R installation and administration
Eric Espino
Administrator manual-e2
Administrator manual-e2
José Ignacio Salamanca
Cockpit esp
Cockpit esp
msabry7
Win plc engine-en
Win plc engine-en
dreamtech2
Rapidminer 4.4-tutorial
Rapidminer 4.4-tutorial
Jeersson Maradiaga
An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224
Banking at Ho Chi Minh city
Sg248107 Implementing the IBM Storwize V3700
Sg248107 Implementing the IBM Storwize V3700
Wellington Torrejais da Silva
Implementing the ibm storwize v3700
Implementing the ibm storwize v3700
Diego Alberto Tamayo
Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...
Banking at Ho Chi Minh city
Akka java
Akka java
dlvladescu
Deployment guide series maximo asset mng 7 1
Deployment guide series maximo asset mng 7 1
Slađan Šehović
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Banking at Ho Chi Minh city
Ibm tivoli system automation for z os enterprise automation sg247308
Ibm tivoli system automation for z os enterprise automation sg247308
Banking at Ho Chi Minh city
Faronics Deep Freeze Enterprise User Guide
Faronics Deep Freeze Enterprise User Guide
Faronics
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Banking at Ho Chi Minh city
Hdclone
Hdclone
Shekar Balasubramanian
Deep Freeze for Mac User Guide
Deep Freeze for Mac User Guide
Faronics
Flask docs
Flask docs
Kunal Sangwan
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
mustafa sarac
More Related Content
What's hot
AIX 5L Differences Guide Version 5.3 Edition
AIX 5L Differences Guide Version 5.3 Edition
IBM India Smarter Computing
Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0
Muhaza Liebenlito
Implementing IBM SmartCloud Entry on IBM PureFlex System
Implementing IBM SmartCloud Entry on IBM PureFlex System
IBM India Smarter Computing
R installation and administration
R installation and administration
Eric Espino
Administrator manual-e2
Administrator manual-e2
José Ignacio Salamanca
Cockpit esp
Cockpit esp
msabry7
Win plc engine-en
Win plc engine-en
dreamtech2
Rapidminer 4.4-tutorial
Rapidminer 4.4-tutorial
Jeersson Maradiaga
An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224
Banking at Ho Chi Minh city
Sg248107 Implementing the IBM Storwize V3700
Sg248107 Implementing the IBM Storwize V3700
Wellington Torrejais da Silva
Implementing the ibm storwize v3700
Implementing the ibm storwize v3700
Diego Alberto Tamayo
Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...
Banking at Ho Chi Minh city
Akka java
Akka java
dlvladescu
Deployment guide series maximo asset mng 7 1
Deployment guide series maximo asset mng 7 1
Slađan Šehović
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Banking at Ho Chi Minh city
Ibm tivoli system automation for z os enterprise automation sg247308
Ibm tivoli system automation for z os enterprise automation sg247308
Banking at Ho Chi Minh city
Faronics Deep Freeze Enterprise User Guide
Faronics Deep Freeze Enterprise User Guide
Faronics
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Banking at Ho Chi Minh city
Hdclone
Hdclone
Shekar Balasubramanian
Deep Freeze for Mac User Guide
Deep Freeze for Mac User Guide
Faronics
What's hot
(20)
AIX 5L Differences Guide Version 5.3 Edition
AIX 5L Differences Guide Version 5.3 Edition
Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0
Implementing IBM SmartCloud Entry on IBM PureFlex System
Implementing IBM SmartCloud Entry on IBM PureFlex System
R installation and administration
R installation and administration
Administrator manual-e2
Administrator manual-e2
Cockpit esp
Cockpit esp
Win plc engine-en
Win plc engine-en
Rapidminer 4.4-tutorial
Rapidminer 4.4-tutorial
An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224
Sg248107 Implementing the IBM Storwize V3700
Sg248107 Implementing the IBM Storwize V3700
Implementing the ibm storwize v3700
Implementing the ibm storwize v3700
Migrating to netcool precision for ip networks --best practices for migrating...
Migrating to netcool precision for ip networks --best practices for migrating...
Akka java
Akka java
Deployment guide series maximo asset mng 7 1
Deployment guide series maximo asset mng 7 1
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Automated provisioning using ibm tivoli intelligent orchestrator and enterpri...
Ibm tivoli system automation for z os enterprise automation sg247308
Ibm tivoli system automation for z os enterprise automation sg247308
Faronics Deep Freeze Enterprise User Guide
Faronics Deep Freeze Enterprise User Guide
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Automation using tivoli net view os 390 v1r3 and system automation os-390 v1r...
Hdclone
Hdclone
Deep Freeze for Mac User Guide
Deep Freeze for Mac User Guide
Similar to Zend Framework 2 Documentation: Getting Started Guide
Flask docs
Flask docs
Kunal Sangwan
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
mustafa sarac
VBoxUserManual.pdf
VBoxUserManual.pdf
vladvah77
Tutorial
Tutorial
Luis Fabián Ortega Ruiz
Odoo development
Odoo development
Ramzi Hajjaji
An Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdf
vishnuraj764102
Ug893 vivado-ide
Ug893 vivado-ide
Carmel Jackoby
Swi prolog-6.2.6
Swi prolog-6.2.6
Omar Reyna Angeles
Manual
Manual
Elhabib Atiea
Manual de usuario de virtualbox
Manual de usuario de virtualbox
Ruben A Lozada S
Openobject developer
Openobject developer
Ali Mashduqi
Debugger.pdf
Debugger.pdf
BuTriLn
Openobject developer1
Openobject developer1
openerpwiki
Open erp openobject-developer
Open erp openobject-developer
openerpwiki
Openobject developer
Openobject developer
openerpwiki
Openobject developer (2)
Openobject developer (2)
openerpwiki
programación en prolog
programación en prolog
Alex Pin
Embedded linux barco-20121001
Embedded linux barco-20121001
Marc Leeman
Sg247692 Websphere Accounting Chargeback For Tuam Guide
Sg247692 Websphere Accounting Chargeback For Tuam Guide
brzaaap
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
Jim Miller, MBA
Similar to Zend Framework 2 Documentation: Getting Started Guide
(20)
Flask docs
Flask docs
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
Explorations in Parallel Distributed Processing: A Handbook of Models, Progra...
VBoxUserManual.pdf
VBoxUserManual.pdf
Tutorial
Tutorial
Odoo development
Odoo development
An Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdf
Ug893 vivado-ide
Ug893 vivado-ide
Swi prolog-6.2.6
Swi prolog-6.2.6
Manual
Manual
Manual de usuario de virtualbox
Manual de usuario de virtualbox
Openobject developer
Openobject developer
Debugger.pdf
Debugger.pdf
Openobject developer1
Openobject developer1
Open erp openobject-developer
Open erp openobject-developer
Openobject developer
Openobject developer
Openobject developer (2)
Openobject developer (2)
programación en prolog
programación en prolog
Embedded linux barco-20121001
Embedded linux barco-20121001
Sg247692 Websphere Accounting Chargeback For Tuam Guide
Sg247692 Websphere Accounting Chargeback For Tuam Guide
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en
Recently uploaded
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptx
Shubham Rawat
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
soniya singh
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
ur8mqw8e
Postal Ballot procedure for employees to utilise
Postal Ballot procedure for employees to utilise
ccsubcollector
Ahmedabad Escorts Girl Services For Male Tourists 9537192988
Ahmedabad Escorts Girl Services For Male Tourists 9537192988
oolala9823
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
Delhi Escorts Service
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Stunning ➥8448380779▻ Call Girls In Hauz Khas Delhi NCR
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
dollysharma2066
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
9953056974 Low Rate Call Girls In Saket, Delhi NCR
young Call girls in Neb Sarai 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Neb Sarai 🔝 9953056974 🔝 Delhi escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
o8wvnojp
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
soniya singh
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做
j5bzwet6
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Aerocity Delhi Escort service
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Aerocity Delhi Escort service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Jess Walker
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
SoniyaSingh
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证
kbdhl05e
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)
oannq
social media chat application main ppt.pptx
social media chat application main ppt.pptx
sprasad829829
Recently uploaded
(20)
Inspiring Through Words Power of Inspiration.pptx
Inspiring Through Words Power of Inspiration.pptx
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Govindpuri Delhi 💯Call Us 🔝8264348440🔝
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
《塔夫斯大学毕业证成绩单购买》做Tufts文凭毕业证成绩单/伪造美国假文凭假毕业证书图片Q微信741003700《塔夫斯大学毕业证购买》《Tufts毕业文...
Postal Ballot procedure for employees to utilise
Postal Ballot procedure for employees to utilise
Ahmedabad Escorts Girl Services For Male Tourists 9537192988
Ahmedabad Escorts Girl Services For Male Tourists 9537192988
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
(No.1)↠Young Call Girls in Sikanderpur (Gurgaon) ꧁❤ 9711911712 ❤꧂ Escorts
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Mg Road Gurgaon
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Call Girls In Karkardooma 83770 87607 Just-Dial Escorts Service 24X7 Avilable
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Lado Sarai Delhi reach out to us at 🔝9953056974🔝
young Call girls in Neb Sarai 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Neb Sarai 🔝 9953056974 🔝 Delhi escort Service
办理西悉尼大学毕业证成绩单、制作假文凭
办理西悉尼大学毕业证成绩单、制作假文凭
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Authentic No 1 Amil Baba In Pakistan Amil Baba In Faisalabad Amil Baba In Kar...
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Kalyan Vihar Delhi 💯 Call Us 🔝8264348440🔝
西伦敦大学毕业证学位证成绩单-怎么样做
西伦敦大学毕业证学位证成绩单-怎么样做
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Aerocity Delhi Escort service
🔝9953056974🔝!!-YOUNG BOOK model Call Girls In Aerocity Delhi Escort service
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
Call Girls In Dwarka Sub City ☎️7838079806 ✅ 💯Call Girls In Delhi
南新罕布什尔大学毕业证学位证成绩单-学历认证
南新罕布什尔大学毕业证学位证成绩单-学历认证
(南达科他州立大学毕业证学位证成绩单-永久存档)
(南达科他州立大学毕业证学位证成绩单-永久存档)
social media chat application main ppt.pptx
social media chat application main ppt.pptx
Zend Framework 2 Documentation: Getting Started Guide
1.
Zend Framework 2
Documentation Release 2.3.1dev Zend Technologies Ltd. March 22, 2014
2.
3.
Contents 1 Overview 1 2
Installation 3 3 Getting Started with Zend Framework 2 5 3.1 Some assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.2 The tutorial application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4 Getting started: A skeleton application 7 4.1 Using the Apache Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2 Using the Built-in PHP CLI Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.3 Error reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5 Routing and controllers 11 6 Create the controller 13 6.1 Initialise the view scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 7 Database and models 15 7.1 The database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7.2 The model files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7.3 Using ServiceManager to configure the table gateway and inject into the AlbumTable . . . . . . . . . 17 7.4 Back to the controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 7.5 Listing albums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 8 Styling and Translations 21 9 Forms and actions 23 9.1 Adding new albums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 9.2 Editing an album . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 9.3 Deleting an album . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 9.4 Ensuring that the home page displays the list of albums . . . . . . . . . . . . . . . . . . . . . . . . . 31 10 Conclusion 33 11 Getting Started with Zend Framework 2 35 11.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 11.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 i
4.
12 A quick
tour of the skeleton application 37 12.1 The dispatch cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 13 The MyTaskList application 39 13.1 The Checklist module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 13.2 The Module class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 14 The application’s pages 43 14.1 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 14.2 The TaskController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 14.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 14.4 Using Service Manager to configure the database credentials and inject into the controller . . . . . . 48 15 Listing tasks 51 15.1 Redirect the home page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 16 Styling 53 17 Adding new tasks 55 18 Editing a task 61 19 Deleting a task 65 20 Application Diagnostics 67 21 Step-by-step debugging 69 22 Conclusion 71 23 Zend Framework Tool (ZFTool) 73 23.1 Installation using Composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 23.2 Manual installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 23.3 Without installation, using the PHAR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 23.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 24 Learning Dependency Injection 77 24.1 Very brief introduction to Di. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 24.2 Simplest usage case (2 classes, one consumes the other) . . . . . . . . . . . . . . . . . . . . . . . . 77 24.3 Simplest Usage Case Without Type-hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 24.4 Simplest usage case with Compiled Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 24.5 Creating a precompiled definition for others to use . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 24.6 Using Multiple Definitions From Multiple Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 24.7 Generating Service Locators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 25 Unit Testing a Zend Framework 2 application 87 25.1 Setting up the tests directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 25.2 Bootstrapping your tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 25.3 Your first controller test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 25.4 A failing test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 25.5 Configuring the service manager for the tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 25.6 Testing actions with POST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 25.7 Testing model entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 25.8 Testing model tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 25.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 ii
5.
26 Using the
EventManager 101 26.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 26.2 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 26.3 Shared managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 27 Wildcards 105 28 Listener aggregates 107 28.1 Introspecting results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 28.2 Short-circuiting listener execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 28.3 Keeping it in order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 28.4 Custom event objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 28.5 Putting it together: Implementing a simple caching system . . . . . . . . . . . . . . . . . . . . . . . 111 28.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 29 Advanced Configuration Tricks 115 29.1 System configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 29.2 Module Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 29.3 Configuration mapping table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 29.4 Configuration Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 29.5 Manipulating merged configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 29.6 Configuration merging workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 30 Using ZendNavigation in your Album Module 123 30.1 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 30.2 Setting Up ZendNavigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 30.3 Configuring our Site Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 30.4 Adding the Menu View Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 30.5 Adding Breadcrumbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 31 Using ZendPaginator in your Album Module 127 31.1 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 31.2 Modifying the AlbumTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 31.3 Modifying the AlbumController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 31.4 Updating the View Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 31.5 Creating the Pagination Control Partial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 32 Using the PaginationControl View Helper 135 33 Setting up a database adapter 137 33.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 33.2 Basic setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 33.3 Setting a static adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 34 Migration from Zend Framework 1 139 35 Namespacing Old Classes 141 35.1 Namespacing a ZF1 Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 35.2 HOWTO Namespace Your Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 36 Running Zend Framework 2 and Zend Framework 1 in parallel 145 36.1 Use ZF2 in a ZF1 project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 36.2 Use ZF1 in a ZF2 project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 36.3 Run ZF1 and ZF2 together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 iii
6.
37 Introduction to
ZendAuthentication 147 37.1 Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 37.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 37.3 Identity Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 37.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 38 Database Table Authentication 155 38.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 38.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 38.3 Advanced Usage: Persisting a DbTable Result Object . . . . . . . . . . . . . . . . . . . . . . . . . . 157 39 Digest Authentication 161 39.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 39.2 Specifics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 39.3 Identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 40 HTTP Authentication Adapter 163 40.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 40.2 Design Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 40.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 40.4 Resolvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 40.5 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 41 LDAP Authentication 167 41.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 41.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 41.3 The API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 41.4 Server Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 41.5 Collecting Debugging Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 41.6 Common Options for Specific Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 42 Authentication Validator 175 42.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 42.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 43 Introduction to ZendBarcode 177 44 Barcode creation using ZendBarcodeBarcode class 179 44.1 Using ZendBarcodeBarcode::factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 44.2 Drawing a barcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 44.3 Rendering a barcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 45 ZendBarcodeBarcode Objects 183 45.1 Common Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 45.2 Common Additional Getters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 45.3 Description of shipped barcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 46 ZendBarcode Renderers 193 46.1 Common Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 46.2 ZendBarcodeRendererImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 46.3 ZendBarcodeRendererPdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 47 ZendCacheStorageAdapter 195 47.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 47.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 47.3 Basic Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 iv
7.
47.4 The StorageInterface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 47.5 The AvailableSpaceCapableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 47.6 The TotalSpaceCapableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 47.7 The ClearByNamespaceInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 47.8 The ClearByPrefixInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 47.9 The ClearExpiredInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 47.10 The FlushableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 47.11 The IterableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 47.12 The OptimizableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 47.13 The TaggableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 47.14 The Apc Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 47.15 The Dba Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 47.16 The Filesystem Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 47.17 The Memcached Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 47.18 The Memory Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 47.19 The WinCache Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 47.20 The XCache Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 47.21 The ZendServerDisk Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 47.22 The ZendServerShm Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 47.23 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 48 ZendCacheStorageCapabilities 211 48.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 48.2 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 48.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 49 ZendCacheStoragePlugin 215 49.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 49.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 49.3 The ClearExpiredByFactor Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 49.4 The ExceptionHandler Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 49.5 The IgnoreUserAbort Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 49.6 The OptimizeByFactor Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 49.7 The Serializer Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 49.8 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 49.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 50 ZendCachePattern 219 50.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 50.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 50.3 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 51 ZendCachePatternCallbackCache 221 51.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 51.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 51.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 51.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 51.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 52 ZendCachePatternClassCache 223 52.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 52.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 52.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 52.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 52.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 v
8.
53 ZendCachePatternObjectCache 227 53.1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 53.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 53.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 53.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 53.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 54 ZendCachePatternOutputCache 231 54.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 54.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 54.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 54.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 54.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 55 ZendCachePatternCaptureCache 233 55.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 55.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 55.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 55.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 55.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 56 Introduction to ZendCaptcha 237 57 Captcha Operation 239 58 CAPTCHA Adapters 241 58.1 ZendCaptchaAbstractWord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 58.2 ZendCaptchaDumb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 58.3 ZendCaptchaFiglet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 58.4 ZendCaptchaImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 58.5 ZendCaptchaReCaptcha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 59 Introduction 245 59.1 Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 60 ZendCodeGenerator Reference 249 60.1 Abstract Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 60.2 Concrete CodeGenerator Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 61 ZendCodeGenerator Examples 257 62 Introduction to ZendConfig 265 62.1 Using ZendConfigConfig with a Reader Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 62.2 Using ZendConfigConfig with a PHP Configuration File . . . . . . . . . . . . . . . . . . . . . . . 266 63 Theory of Operation 267 64 ZendConfigReader 269 64.1 ZendConfigReaderIni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 64.2 ZendConfigReaderXml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 64.3 ZendConfigReaderJson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 64.4 ZendConfigReaderYaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 65 ZendConfigWriter 275 65.1 ZendConfigWriterIni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 65.2 ZendConfigWriterXml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 vi
9.
65.3 ZendConfigWriterPhpArray .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 65.4 ZendConfigWriterJson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 65.5 ZendConfigWriterYaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 66 ZendConfigProcessor 281 66.1 ZendConfigProcessorConstant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 66.2 ZendConfigProcessorFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 66.3 ZendConfigProcessorQueue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 66.4 ZendConfigProcessorToken . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 66.5 ZendConfigProcessorTranslator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 67 The Factory 285 67.1 Loading configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 67.2 Storing configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 68 Introduction to ZendConsole 287 68.1 Writing console routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 68.2 Handling console requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 68.3 Adding console usage info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 69 Console routes and routing 293 69.1 Router configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 69.2 Basic route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 69.3 Catchall route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 69.4 Console routes cheat-sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 70 Console-aware modules 301 70.1 Application banner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 70.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 70.3 Best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 71 Console-aware action controllers 307 71.1 Handling console requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 71.2 Sending output to console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 71.3 Are we in a console? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 71.4 Reading values from console parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 72 Console adapters 315 72.1 Retrieving console adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 72.2 Using console adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 73 Console prompts 319 73.1 Confirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 73.2 Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 73.3 Char . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 73.4 Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 74 Introduction 323 75 Declaring Getopt Rules 325 75.1 Declaring Options with the Short Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 75.2 Declaring Options with the Long Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 76 Fetching Options and Arguments 327 76.1 Handling Getopt Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 76.2 Fetching Options by Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 vii
10.
76.3 Reporting Options
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 76.4 Fetching Non-option Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 77 Configuring ZendConsoleGetopt 331 77.1 Adding Option Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 77.2 Adding Help Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 77.3 Adding Option Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 77.4 Adding Argument Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 77.5 Adding Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 78 Introduction to ZendCrypt 335 79 Encrypt/decrypt using block ciphers 337 80 Key derivation function 339 80.1 Pbkdf2 adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 80.2 SaltedS2k adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 80.3 Scrypt adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 81 Password 343 81.1 Bcrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 81.2 Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 82 Public key cryptography 347 82.1 Diffie-Hellman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 82.2 RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 83 ZendDbAdapter 351 83.1 Creating an Adapter - Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 83.2 Creating an Adapter Using Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 83.3 Query Preparation Through ZendDbAdapterAdapter::query() . . . . . . . . . . . . . . . . . . . . 352 83.4 Query Execution Through ZendDbAdapterAdapter::query() . . . . . . . . . . . . . . . . . . . . . 353 83.5 Creating Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 83.6 Using the Driver Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 83.7 Using The Platform Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 83.8 Using The Parameter Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 83.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 84 ZendDbResultSet 359 84.1 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 84.2 ZendDbResultSetResultSet and ZendDbResultSetAbstractResultSet . . . . . . . . . . . . . . . . 360 84.3 ZendDbResultSetHydratingResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 85 ZendDbSql 363 85.1 ZendDbSqlSql (Quickstart) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 85.2 ZendDbSql’s Select, Insert, Update and Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 85.3 ZendDbSqlSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 85.4 ZendDbSqlInsert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 85.5 ZendDbSqlUpdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 85.6 ZendDbSqlDelete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 85.7 ZendDbSqlWhere & ZendDbSqlHaving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 86 ZendDbSqlDdl 375 86.1 Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 86.2 Altering Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 86.3 Dropping Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 viii
11.
86.4 Executing DDL
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 86.5 Currently Supported Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 86.6 Currently Supported Constraint Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 87 ZendDbTableGateway 379 87.1 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 87.2 TableGateway Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 88 ZendDbRowGateway 383 88.1 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 88.2 ActiveRecord Style Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 89 ZendDbMetadata 385 89.1 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 90 Dumping Variables 389 90.1 Example of dump() method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 91 Introduction to ZendDi 391 91.1 Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 91.2 Dependency Injection Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 92 ZendDi Quickstart 393 93 ZendDi Definition 397 93.1 DefinitionList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 93.2 RuntimeDefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 93.3 CompilerDefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 93.4 ClassDefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 94 ZendDi InstanceManager 401 94.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 94.2 Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 94.3 Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 95 ZendDi Configuration 405 96 ZendDi Debugging & Complex Use Cases 407 96.1 Debugging a DiC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 96.2 Complex Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 97 Introduction to ZendDom 411 98 ZendDomQuery 413 98.1 Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 98.2 Methods Available . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 99 Introduction to ZendEscaper 417 99.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 99.2 What ZendEscaper is not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 100Theory of Operation 419 100.1 The Problem with Inconsistent Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 100.2 Why Contextual Escaping? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 101Configuring ZendEscaper 423 ix
12.
102Escaping HTML 425 102.1
Examples of Bad HTML Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 102.2 Examples of Good HTML Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 103Escaping HTML Attributes 427 103.1 Examples of Bad HTML Attribute Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 103.2 Examples of Good HTML Attribute Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 104Escaping Javascript 431 104.1 Examples of Bad Javascript Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 104.2 Examples of Good Javascript Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 105Escaping Cascading Style Sheets 433 105.1 Examples of Bad CSS Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 105.2 Examples of Good CSS Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 106Escaping URLs 435 106.1 Examples of Bad URL Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 106.2 Examples of Good URL Escaping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 107The EventManager 437 107.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 107.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 107.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 107.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 107.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 108Using Exceptions 447 108.1 Catching an Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 109Introduction to ZendFeed 449 109.1 Reading RSS Feed Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 110Importing Feeds 451 110.1 Dumping the contents of a feed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 111Retrieving Feeds from Web Pages 453 111.1 Find Feed Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 112Consuming an RSS Feed 455 112.1 Reading a feed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 112.2 Get properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 113Consuming an Atom Feed 457 113.1 Basic Use of an Atom Feed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 114Consuming a Single Atom Entry 459 114.1 Reading a Single-Entry Atom Feed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 115ZendFeed and Security 461 115.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 115.2 Filtering data using HTMLPurifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 115.3 Escaping data using ZendEscaper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 116ZendFeedReaderReader 465 116.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 x
13.
116.2 Importing Feeds
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 116.3 Retrieving Underlying Feed and Entry Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 116.4 Cache Support and Intelligent Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 116.5 Locating Feed URIs from Websites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 116.6 Attribute Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 116.7 Retrieving Feed Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 116.8 Retrieving Entry/Item Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 116.9 Extending Feed and Entry APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 117ZendFeedWriterWriter 479 117.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 117.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 117.3 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 117.4 Setting Feed Data Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 117.5 Setting Entry Data Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 118ZendFeedPubSubHubbub 487 118.1 What is PubSubHubbub? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 118.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 118.3 ZendFeedPubSubHubbubPublisher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 118.4 ZendFeedPubSubHubbubSubscriber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 119ZendFileClassFileLocator 495 119.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 119.2 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 119.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 120Introduction to ZendFilter 497 120.1 What is a filter? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 120.2 Basic usage of filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 120.3 Using the StaticFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 120.4 Double filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 121Standard Filter Classes 501 121.1 Alnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 121.2 Alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 121.3 BaseName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502 121.4 Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 121.5 Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 121.6 Compress and Decompress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 121.7 Digits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 121.8 Dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 121.9 Encrypt and Decrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 121.10HtmlEntities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 121.11Int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 121.12Null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 121.13NumberFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 121.14PregReplace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 121.15RealPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 121.16StringToLower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 121.17StringToUpper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 121.18StringTrim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526 121.19StripNewLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 121.20StripTags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 121.21UriNormalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 xi
14.
122Word Filters 531 122.1
CamelCaseToDash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 122.2 CamelCaseToSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 122.3 CamelCaseToUnderscore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 122.4 DashToCamelCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 122.5 DashToSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 122.6 DashToUnderscore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 122.7 SeparatorToCamelCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534 122.8 SeparatorToDash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534 122.9 SeparatorToSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 122.10UnderscoreToCamelCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 122.11UnderscoreToSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 122.12UnderscoreToDash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 123File Filter Classes 539 123.1 Decrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 123.2 Encrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 123.3 Lowercase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 123.4 Rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 123.5 RenameUpload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 123.6 Uppercase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 124Filter Chains 545 124.1 Setting Filter Chain Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 124.2 Using the Plugin Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 125ZendFilterInflector 547 125.1 Transforming MixedCase and camelCaseText to another format . . . . . . . . . . . . . . . . . . . . 547 125.2 Static Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 125.3 Filter Inflector Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 125.4 Setting Many Rules At Once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 125.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 126Using the StaticFilter 553 127Writing Filters 555 127.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 128Introduction 557 129Quick Start 559 129.1 Programmatic Form Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 129.2 Creation via Factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 129.3 Factory-backed Form Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564 129.4 Validating Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 129.5 Hinting to the Input Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 129.6 Binding an object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 129.7 Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 129.8 Validation Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 129.9 Using Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 130Form Collections 577 130.1 Creating Fieldsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 130.2 The Form Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 130.3 The Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 xii
15.
130.4 The View
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 130.5 Adding New Elements Dynamically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 130.6 Validation groups for fieldsets and collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 131File Uploading 591 131.1 Standard Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 131.2 File Post-Redirect-Get Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 131.3 HTML5 Multi-File Uploads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596 131.4 Upload Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 131.5 Additional Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 132Advanced use of forms 603 132.1 Short names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 132.2 Creating custom elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 132.3 Handling dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 132.4 The specific case of initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 133Form Elements 611 133.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 133.2 Element Base Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 133.3 Standard Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 133.4 HTML5 Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 134Form View Helpers 643 134.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 134.2 Standard Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 134.3 HTML5 Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657 134.4 File Upload Progress Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 135ZendHttp 663 135.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 135.2 ZendHttp Request, Response and Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 136The Request Class 665 136.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 136.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 136.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 136.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 136.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 137The Response Class 671 137.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 137.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 137.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 137.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 137.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 138The Headers Class 677 138.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 138.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 138.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 138.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 138.5 ZendHttpHeaderHeaderInterface Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 138.6 ZendHttpHeaderAbstractAccept Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 138.7 ZendHttpHeaderAbstractDate Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 xiii
16.
138.8 ZendHttpHeaderAbstractLocation Methods
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 138.9 List of HTTP Header Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 138.10Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 139HTTP Client 689 139.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 139.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 139.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 139.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 140HTTP Client - Connection Adapters 695 140.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 140.2 The Socket Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 140.3 The Proxy Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 140.4 The cURL Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 140.5 The Test Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700 140.6 Creating your own connection adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 141HTTP Client - Advanced Usage 705 141.1 HTTP Redirections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 141.2 Adding Cookies and Using Cookie Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 141.3 Setting Custom Request Headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 141.4 File Uploads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 141.5 Sending Raw POST Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 141.6 HTTP Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 141.7 Sending Multiple Requests With the Same Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 141.8 Data Streaming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 142HTTP Client - Static Usage 713 142.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 142.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 142.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 142.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 143Translating 715 143.1 Adding translations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 143.2 Supported formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 143.3 Setting a locale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 143.4 Translating messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 143.5 Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 144I18n View Helpers 717 144.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 144.2 CurrencyFormat Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 144.3 DateFormat Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 144.4 NumberFormat Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 144.5 Plural Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 144.6 Translate Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 144.7 TranslatePlural Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 144.8 Abstract Translator Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 145I18n Filters 727 145.1 Alnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 145.2 Alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 145.3 NumberFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 xiv
17.
145.4 NumberParse .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 146I18n Validators 731 147Float 733 147.1 Supported options for ZendI18nValidatorFloat . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 147.2 Simple float validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 147.3 Localized float validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 147.4 Int . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 148Introduction 735 149File Upload Input 739 149.1 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 150Introduction 741 151Basic Usage 743 151.1 Pretty-printing JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 152Advanced Usage 745 152.1 JSON Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 152.2 Encoding PHP objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 152.3 Internal Encoder/Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 152.4 JSON Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 153XML to JSON conversion 747 153.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747 154ZendJsonServer - JSON-RPC server 749 154.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 154.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 154.3 Advanced Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751 155Introduction to ZendLdap 757 155.1 Theory of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 156API overview 761 156.1 Configuration / options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761 156.2 API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762 157ZendLdapLdap 763 157.1 ZendLdapCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764 158ZendLdapAttribute 765 159ZendLdapConverterConverter 767 160ZendLdapDn 769 161ZendLdapFilter 773 162ZendLdapNode 777 163ZendLdapNodeRootDse 779 163.1 OpenLDAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 163.2 ActiveDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 xv
18.
163.3 eDirectory .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 164ZendLdapNodeSchema 785 164.1 OpenLDAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787 164.2 ActiveDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788 165ZendLdapLdifEncoder 789 166Usage Scenarios 791 166.1 Authentication scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 166.2 Basic CRUD operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791 166.3 Extended operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793 167Tools 795 167.1 Creation and modification of DN strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 167.2 Using the filter API to create search filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 167.3 Modify LDAP entries using the Attribute API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795 168Object-oriented access to the LDAP tree using ZendLdapNode 797 168.1 Basic CRUD operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 168.2 Extended operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 168.3 Tree traversal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797 169Getting information from the LDAP server 799 169.1 RootDSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799 169.2 Schema Browsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799 170Serializing LDAP data to and from LDIF 801 170.1 Serialize a LDAP entry to LDIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801 170.2 Deserialize a LDIF string into a LDAP entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802 171The AutoloaderFactory 805 171.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 171.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805 171.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806 171.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806 171.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806 172The StandardAutoloader 807 172.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807 172.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808 172.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809 172.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809 172.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810 173The ClassMapAutoloader 811 173.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811 173.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811 173.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812 173.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812 173.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813 174The ModuleAutoloader 815 174.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815 174.2 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815 174.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815 xvi
19.
174.4 Available Methods
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815 174.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816 175The SplAutoloader Interface 817 175.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817 175.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817 175.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818 175.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818 175.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819 176The PluginClassLoader 821 176.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 176.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821 176.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822 176.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822 176.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823 177The ShortNameLocator Interface 827 177.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827 177.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827 177.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827 177.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828 177.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828 178The PluginClassLocator interface 829 178.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 178.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 178.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 178.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 178.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830 179The Class Map Generator utility: bin/classmap_generator.php 831 179.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831 179.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831 179.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831 180ZendLog 833 180.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833 180.2 Creating a Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833 180.3 Logging Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834 180.4 Destroying a Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834 180.5 Using Built-in Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834 180.6 Understanding Log Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835 180.7 Log PHP Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835 181Writers 837 181.1 Writing to Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 181.2 Writing to Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 181.3 Writing to FirePHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 181.4 Stubbing Out the Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 181.5 Testing with the Mock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 181.6 Compositing Writers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 182Filters 841 182.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 xvii
20.
182.2 Available filters
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 183Formatters 843 183.1 Simple Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843 183.2 Formatting to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843 183.3 Formatting to FirePhp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844 184Introduction to ZendMail 845 184.1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845 184.2 Configuring the default sendmail transport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846 185ZendMailMessage 847 185.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 185.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847 185.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849 185.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849 185.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 852 186ZendMailTransport 853 186.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853 186.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853 186.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854 186.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855 186.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855 187ZendMailTransportSmtpOptions 857 187.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857 187.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857 187.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859 187.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859 187.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860 188ZendMailTransportFileOptions 861 188.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861 188.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861 188.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861 188.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861 188.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862 189Introduction to ZendMath 863 189.1 Random number generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863 189.2 Big integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864 190Overview 867 190.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867 190.2 Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868 191Memory Manager 869 191.1 Creating a Memory Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869 191.2 Managing Memory Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869 191.3 Memory Manager Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870 192Memory Objects 873 192.1 Movable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873 192.2 Locked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873 192.3 Memory container ‘value’ property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873 xviii
21.
192.4 Memory container
interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874 193ZendMime 877 193.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877 193.2 Static Methods and Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877 193.3 Instantiating ZendMime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878 194ZendMimeMessage 879 194.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879 194.2 Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879 194.3 Adding MIME Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879 194.4 Boundary handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879 194.5 Parsing a string to create a ZendMimeMessage object . . . . . . . . . . . . . . . . . . . . . . . . . 880 194.6 Available methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880 195ZendMimePart 881 195.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881 195.2 Instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881 195.3 Methods for rendering the message part to a string . . . . . . . . . . . . . . . . . . . . . . . . . . . 881 195.4 Available methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882 196Introduction to the Module System 883 196.1 The autoload_*.php Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884 197The Module Manager 885 197.1 Module Manager Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885 197.2 Module Manager Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886 198The Module Class 889 198.1 A Minimal Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889 198.2 A Typical Module Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889 198.3 The “loadModules.post” Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890 198.4 The MVC “bootstrap” Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891 199The Module Autoloader 893 199.1 Module Autoloader Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893 199.2 Non-Standard / Explicit Module Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894 199.3 Packaging Modules with Phar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895 200Best Practices when Creating Modules 897 200.1 Keep the init() and onBootstrap() methods lightweight . . . . . . . . . . . . . . . . . . . . 897 200.2 Do not perform writes within a module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897 200.3 Utilize a vendor prefix for module names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897 200.4 Utilize a module prefix for service names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898 201Introduction to the MVC Layer 899 201.1 Basic Application Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899 201.2 Basic Module Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900 201.3 Bootstrapping an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 201.4 Bootstrapping a Modular Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904 201.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905 202Quick Start 907 202.1 Install the Zend Skeleton Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907 202.2 Create a New Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908 202.3 Update the Module Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908 xix
22.
202.4 Create a
Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909 202.5 Create a View Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910 202.6 Create a Route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910 202.7 Tell the Application About our Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912 202.8 Test it Out! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912 203Default Services 915 203.1 Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915 203.2 ServiceManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915 203.3 Abstract Factories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920 203.4 Plugin Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922 203.5 ViewManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923 203.6 Application Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 924 203.7 Default Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925 204Routing 929 204.1 Router Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931 204.2 HTTP Route Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931 204.3 HTTP Routing Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937 204.4 Console Route Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940 205The MvcEvent 941 205.1 Order of events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942 205.2 MvcEvent::EVENT_BOOTSTRAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942 205.3 MvcEvent::EVENT_ROUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 205.4 MvcEvent::EVENT_DISPATCH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 205.5 MvcEvent::EVENT_DISPATCH_ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945 205.6 MvcEvent::EVENT_RENDER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946 205.7 MvcEvent::EVENT_RENDER_ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947 205.8 MvcEvent::EVENT_FINISH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948 206The SendResponseEvent 949 206.1 Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 949 206.2 Triggerers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 949 207Available Controllers 951 207.1 Common Interfaces Used With Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951 207.2 The AbstractActionController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953 207.3 The AbstractRestfulController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954 208Controller Plugins 957 208.1 AcceptableViewModelSelector Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957 208.2 FlashMessenger Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958 208.3 Forward Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960 208.4 Identity Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961 208.5 Layout Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962 208.6 Params Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962 208.7 Post/Redirect/Get Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963 208.8 File Post/Redirect/Get Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963 208.9 Redirect Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964 208.10Url Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965 209Examples 967 209.1 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967 209.2 Bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968 xx
23.
210Introduction to ZendNavigation
969 210.1 Pages and Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969 210.2 View Helpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969 211Quick Start 971 212Pages 973 212.1 Common page features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973 212.2 ZendNavigationPageMvc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 975 212.3 ZendNavigationPageUri . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978 212.4 Creating custom page types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978 212.5 Creating pages using the page factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 979 213Containers 983 213.1 Creating containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 983 213.2 Adding pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989 213.3 Removing pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 213.4 Finding pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991 213.5 Iterating containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 213.6 Other operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993 214View Helpers 997 214.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 214.2 Translation of labels and titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 214.3 Integration with ACL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 214.4 Navigation setup used in examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999 215View Helper - Breadcrumbs 1005 215.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005 215.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005 215.3 Specifying indentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 215.4 Customize output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 215.5 Rendering using a partial view script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006 216View Helper - Links 1009 216.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1009 216.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011 217View Helper - Menu 1013 217.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1013 217.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1014 217.3 Calling renderMenu() directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1015 217.4 Rendering the deepest active menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1016 217.5 Rendering with maximum depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1016 217.6 Rendering with minimum depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1017 217.7 Rendering only the active branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1018 217.8 Rendering only the active branch with minimum depth . . . . . . . . . . . . . . . . . . . . . . . . . 1019 217.9 Rendering only the active branch with maximum depth . . . . . . . . . . . . . . . . . . . . . . . . . 1019 217.10Rendering only the active branch with maximum depth and no parents . . . . . . . . . . . . . . . . . 1020 217.11Rendering a custom menu using a partial view script . . . . . . . . . . . . . . . . . . . . . . . . . . 1020 218View Helper - Sitemap 1023 218.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023 218.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024 218.3 Rendering using no ACL role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1025 xxi
24.
218.4 Rendering using
a maximum depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1026 219View Helper - Navigation Proxy 1029 219.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029 219.2 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029 220Introduction to ZendPaginator 1031 221Usage 1033 221.1 Paginating data collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033 221.2 The DbSelect adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034 221.3 Rendering pages with view scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1035 222Configuration 1041 223Advanced usage 1043 223.1 Custom data source adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1043 223.2 Custom scrolling styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1043 223.3 Caching features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1044 224Introduction to ZendPermissionsAcl 1047 224.1 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 224.2 Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048 224.3 Creating the Access Control List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049 224.4 Registering Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049 224.5 Defining Access Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050 224.6 Querying an ACL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1051 225Refining Access Controls 1053 225.1 Precise Access Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053 225.2 Removing Access Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1054 226Advanced Usage 1057 226.1 Storing ACL Data for Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057 226.2 Writing Conditional ACL Rules with Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057 227Introduction to ZendPermissionsRbac 1059 227.1 Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 227.2 Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 227.3 Dynamic Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 228Methods 1061 229Examples 1063 229.1 Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063 229.2 Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064 229.3 Dynamic Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064 230Progress Bars 1067 230.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 230.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 230.3 Persistent Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 230.4 Standard Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1068 231File Upload Handlers 1071 231.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1071 xxii
25.
231.2 Methods of
Reporting Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1071 231.3 Standard Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072 232Introduction to ZendSerializer 1075 232.1 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075 232.2 Basic configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076 232.3 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076 233ZendSerializerAdapter 1079 233.1 The PhpSerialize Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079 233.2 The IgBinary Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079 233.3 The Wddx Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079 233.4 The Json Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080 233.5 The PythonPickle Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1080 233.6 The PhpCode Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1081 234Introduction to ZendServer 1083 235ZendServerReflection 1085 235.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1085 235.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1085 236ZendServiceManager 1087 237ZendServiceManager Quick Start 1091 237.1 Using Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1091 237.2 Modules as Service Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092 237.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092 238Delegator service factories 1097 238.1 Delegator factory signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097 238.2 A Delegator factory use case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097 239Lazy Services 1101 239.1 Use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1101 239.2 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1101 239.3 Practical example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1101 239.4 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1103 240Session Config 1105 240.1 Standard Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1105 240.2 Session Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1106 240.3 Custom Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1107 241Session Container 1109 241.1 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109 241.2 Setting the Default Session Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109 242Session Manager 1111 242.1 Initializing the Session Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1111 242.2 Session Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1113 243Session Save Handlers 1115 243.1 Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115 243.2 DbTableGateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115 243.3 MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1116 xxiii
Download now