1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu ZendFramework 2 3 1

1.7K 2.6K 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Overview

  • Installation

  • Getting Started with Zend Framework 2

    • Some assumptions

    • The tutorial application

  • Getting started: A skeleton application

    • Using the Apache Web Server

    • Using the Built-in PHP CLI Server

    • Error reporting

  • Routing and controllers

  • Create the controller

    • Initialise the view scripts

  • Database and models

    • The database

    • The model files

    • Using ServiceManager to configure the table gateway and inject into the AlbumTable

    • Back to the controller

    • Listing albums

  • Styling and Translations

  • Forms and actions

    • Adding new albums

    • Editing an album

    • Deleting an album

    • Ensuring that the home page displays the list of albums

  • Conclusion

  • Getting Started with Zend Framework 2

    • Installation

    • Getting Started

  • A quick tour of the skeleton application

    • The dispatch cycle

  • The MyTaskList application

    • The Checklist module

    • The Module class

  • The application's pages

    • Routing

    • The TaskController

    • The model

    • Using Service Manager to configure the database credentials and inject into the controller

  • Listing tasks

    • Redirect the home page

  • Styling

  • Adding new tasks

  • Editing a task

  • Deleting a task

  • Application Diagnostics

  • Step-by-step debugging

  • Conclusion

  • Zend Framework Tool (ZFTool)

    • Installation using Composer

    • Manual installation

    • Without installation, using the PHAR file

    • Usage

  • Learning Dependency Injection

    • Very brief introduction to Di.

    • Simplest usage case (2 classes, one consumes the other)

    • Simplest Usage Case Without Type-hints

    • Simplest usage case with Compiled Definition

    • Creating a precompiled definition for others to use

    • Using Multiple Definitions From Multiple Sources

    • Generating Service Locators

  • Unit Testing a Zend Framework 2 application

    • Setting up the tests directory

    • Bootstrapping your tests

    • Your first controller test

    • A failing test case

    • Configuring the service manager for the tests

    • Testing actions with POST

    • Testing model entities

    • Testing model tables

    • Conclusion

  • Using the EventManager

    • Terminology

    • Getting started

    • Shared managers

  • Wildcards

  • Listener aggregates

    • Introspecting results

    • Short-circuiting listener execution

    • Keeping it in order

    • Custom event objects

    • Putting it together: Implementing a simple caching system

    • Conclusion

  • Advanced Configuration Tricks

    • System configuration

    • Module Configuration

    • Configuration mapping table

    • Configuration Priority

    • Manipulating merged configuration

    • Configuration merging workflow

  • Using Zend\Navigation in your Album Module

    • Preparation

    • Setting Up Zend\Navigation

    • Configuring our Site Map

    • Adding the Menu View Helper

    • Adding Breadcrumbs

  • Using Zend\Paginator in your Album Module

    • Preparation

    • Modifying the AlbumTable

    • Modifying the AlbumController

    • Updating the View Script

    • Creating the Pagination Control Partial

  • Using the PaginationControl View Helper

  • Setting up a database adapter

    • Introduction

    • Basic setup

    • Setting a static adapter

  • Migration from Zend Framework 1

  • Namespacing Old Classes

    • Namespacing a ZF1 Application

    • HOWTO Namespace Your Models

  • Running Zend Framework 2 and Zend Framework 1 in parallel

    • Use ZF2 in a ZF1 project

    • Use ZF1 in a ZF2 project

    • Run ZF1 and ZF2 together

  • Introduction to Zend\Authentication

    • Adapters

    • Results

    • Identity Persistence

    • Usage

  • Database Table Authentication

    • Introduction

    • Basic Usage

    • Advanced Usage: Persisting a DbTable Result Object

  • Digest Authentication

    • Introduction

    • Specifics

    • Identity

  • HTTP Authentication Adapter

    • Introduction

    • Design Overview

    • Configuration Options

    • Resolvers

    • Basic Usage

  • LDAP Authentication

    • Introduction

    • Usage

    • The API

    • Server Options

    • Collecting Debugging Messages

    • Common Options for Specific Servers

  • Authentication Validator

    • Introduction

    • Basic Usage

  • Introduction to Zend\Barcode

  • Barcode creation using Zend\Barcode\Barcode class

    • Using Zend\Barcode\Barcode::factory

    • Drawing a barcode

    • Rendering a barcode

  • Zend\Barcode\Barcode Objects

    • Common Options

    • Common Additional Getters

    • Description of shipped barcodes

  • Zend\Barcode Renderers

    • Common Options

    • Zend\Barcode\Renderer\Image

    • Zend\Barcode\Renderer\Pdf

  • Zend\Cache\Storage\Adapter

    • Overview

    • Quick Start

    • Basic Configuration Options

    • The StorageInterface

    • The AvailableSpaceCapableInterface

    • The TotalSpaceCapableInterface

    • The ClearByNamespaceInterface

    • The ClearByPrefixInterface

    • The ClearExpiredInterface

    • The FlushableInterface

    • The IterableInterface

    • The OptimizableInterface

    • The TaggableInterface

    • The Apc Adapter

    • The Dba Adapter

    • The Filesystem Adapter

    • The Memcached Adapter

    • The Memory Adapter

    • The WinCache Adapter

    • The XCache Adapter

    • The ZendServerDisk Adapter

    • The ZendServerShm Adapter

    • Examples

  • Zend\Cache\Storage\Capabilities

    • Overview

    • Available Methods

    • Examples

  • Zend\Cache\Storage\Plugin

    • Overview

    • Quick Start

    • The ClearExpiredByFactor Plugin

    • The ExceptionHandler Plugin

    • The IgnoreUserAbort Plugin

    • The OptimizeByFactor Plugin

    • The Serializer Plugin

    • Available Methods

    • Examples

  • Zend\Cache\Pattern

    • Overview

    • Quick Start

    • Available Methods

  • Zend\Cache\Pattern\CallbackCache

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Cache\Pattern\ClassCache

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Cache\Pattern\ObjectCache

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Cache\Pattern\OutputCache

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Cache\Pattern\CaptureCache

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Introduction to Zend\Captcha

    • Overview

  • Captcha Operation

    • The AdapterInterface

    • Basic Usage

  • CAPTCHA Adapters

    • Zend\Captcha\AbstractWord

    • Zend\Captcha\Dumb

    • Zend\Captcha\Figlet

    • Zend\Captcha\Image

    • Zend\Captcha\ReCaptcha

  • Introduction

    • Theory of Operation

  • ZendCodeGenerator Reference

    • Abstract Classes and Interfaces

    • Concrete CodeGenerator Classes

  • ZendCodeGenerator Examples

  • Introduction to Zend\Config

    • Using Zend\Config\Config with a Reader Class

    • Using Zend\Config\Config with a PHP Configuration File

  • Theory of Operation

  • Zend\Config\Reader

    • Zend\Config\Reader\Ini

    • Zend\Config\Reader\Xml

    • Zend\Config\Reader\Json

    • Zend\Config\Reader\Yaml

  • Zend\Config\Writer

    • Zend\Config\Writer\Ini

    • Zend\Config\Writer\Xml

    • Zend\Config\Writer\PhpArray

    • Zend\Config\Writer\Json

    • Zend\Config\Writer\Yaml

  • Zend\Config\Processor

    • Zend\Config\Processor\Constant

    • Zend\Config\Processor\Filter

    • Zend\Config\Processor\Queue

    • Zend\Config\Processor\Token

    • Zend\Config\Processor\Translator

  • The Factory

    • Loading configuration file

    • Storing configuration file

  • Introduction to Zend\Console

    • Writing console routes

    • Handling console requests

    • Adding console usage info

  • Console routes and routing

    • Router configuration

    • Basic route

    • Catchall route

    • Console routes cheat-sheet

  • Console-aware modules

    • Application banner

    • Basic usage

    • Best practices

  • Console-aware action controllers

    • Handling console requests

    • Sending output to console

    • Are we in a console?

    • Reading values from console parameters

  • Console adapters

    • Retrieving console adapter

    • Using console adapter

  • Console prompts

    • Confirm

    • Line

    • Char

    • Select

  • ZendConsoleGetopt

    • Introduction

  • Declaring Getopt Rules

    • Declaring Options with the Short Syntax

    • Declaring Options with the Long Syntax

  • Fetching Options and Arguments

    • Handling Getopt Exceptions

    • Fetching Options by Name

    • Reporting Options

    • Fetching Non-option Arguments

  • Configuring Zend\Console\Getopt

    • Adding Option Rules

    • Adding Help Messages

    • Adding Option Aliases

    • Adding Argument Lists

    • Adding Configuration

  • Introduction to Zend\Crypt

  • Encrypt/decrypt using block ciphers

  • Key derivation function

    • Pbkdf2 adapter

    • SaltedS2k adapter

    • Scrypt adapter

  • Password

    • Bcrypt

    • Apache

  • Public key cryptography

    • Diffie-Hellman

    • RSA

  • Zend\Db\Adapter

    • Creating an Adapter - Quickstart

    • Creating an Adapter Using Dependency Injection

    • Query Preparation Through Zend\Db\Adapter\Adapter::query()

    • Query Execution Through Zend\Db\Adapter\Adapter::query()

    • Creating Statements

    • Using the Driver Object

    • Using The Platform Object

    • Using The Parameter Container

    • Examples

  • Zend\Db\ResultSet

    • Quickstart

    • Zend\Db\ResultSet\ResultSet and Zend\Db\ResultSet\AbstractResultSet

    • Zend\Db\ResultSet\HydratingResultSet

  • Zend\Db\Sql

    • Zend\Db\Sql\Sql (Quickstart)

    • Zend\Db\Sql's Select, Insert, Update and Delete

    • Zend\Db\Sql\Select

    • Zend\Db\Sql\Insert

    • Zend\Db\Sql\Update

    • Zend\Db\Sql\Delete

    • Zend\Db\Sql\Where & Zend\Db\Sql\Having

  • Zend\Db\Sql\Ddl

    • Creating Tables

    • Altering Tables

    • Dropping Tables

    • Executing DDL Statements

    • Currently Supported Data Types

    • Currently Supported Constraint Types

  • Zend\Db\TableGateway

    • Basic Usage

    • TableGateway Features

  • Zend\Db\RowGateway

    • Quickstart

    • ActiveRecord Style Objects

  • Zend\Db\Metadata

    • Basic Usage

  • Dumping Variables

    • Example of dump() method

  • Introduction to Zend\Di

    • Dependency Injection

    • Dependency Injection Containers

  • Zend\Di Quickstart

  • Zend\Di Definition

    • DefinitionList

    • RuntimeDefinition

    • CompilerDefinition

    • ClassDefinition

  • Zend\Di InstanceManager

    • Parameters

    • Preferences

    • Aliases

  • Zend\Di Configuration

  • Zend\Di Debugging & Complex Use Cases

    • Debugging a DiC

    • Complex Use Cases

  • Introduction to Zend\Dom

  • Zend\Dom\Query

    • Theory of Operation

    • Methods Available

  • Introduction to Zend\Escaper

    • Overview

    • What Zend\Escaper is not

  • Theory of Operation

    • The Problem with Inconsistent Functionality

    • Why Contextual Escaping?

  • Configuring Zend\Escaper

  • Escaping HTML

    • Examples of Bad HTML Escaping

    • Examples of Good HTML Escaping

  • Escaping HTML Attributes

    • Examples of Bad HTML Attribute Escaping

    • Examples of Good HTML Attribute Escaping

  • Escaping Javascript

    • Examples of Bad Javascript Escaping

    • Examples of Good Javascript Escaping

  • Escaping Cascading Style Sheets

    • Examples of Bad CSS Escaping

    • Examples of Good CSS Escaping

  • Escaping URLs

    • Examples of Bad URL Escaping

    • Examples of Good URL Escaping

  • The EventManager

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Using Exceptions

    • Catching an Exception

  • Introduction to Zend\Feed

    • Reading RSS Feed Data

  • Importing Feeds

    • Dumping the contents of a feed

  • Retrieving Feeds from Web Pages

    • Find Feed Links

  • Consuming an RSS Feed

    • Reading a feed

    • Get properties

  • Consuming an Atom Feed

    • Basic Use of an Atom Feed

  • Consuming a Single Atom Entry

    • Reading a Single-Entry Atom Feed

  • Zend\Feed and Security

    • Introduction

    • Filtering data using HTMLPurifier

    • Escaping data using Zend\Escaper

  • Zend\Feed\Reader\Reader

    • Introduction

    • Importing Feeds

    • Retrieving Underlying Feed and Entry Sources

    • Cache Support and Intelligent Requests

    • Locating Feed URIs from Websites

    • Attribute Collections

    • Retrieving Feed Information

    • Retrieving Entry/Item Information

    • Extending Feed and Entry APIs

  • Zend\Feed\Writer\Writer

    • Introduction

    • Architecture

    • Getting Started

    • Setting Feed Data Points

    • Setting Entry Data Points

  • Zend\Feed\PubSubHubbub

    • What is PubSubHubbub?

    • Architecture

    • Zend\Feed\PubSubHubbub\Publisher

    • Zend\Feed\PubSubHubbub\Subscriber

  • Zend\File\ClassFileLocator

    • Overview

    • Available Methods

    • Examples

  • Introduction to Zend\Filter

    • What is a filter?

    • Basic usage of filters

    • Using the StaticFilter

    • Double filtering

  • Standard Filter Classes

    • Alnum

    • Alpha

    • BaseName

    • Boolean

    • Callback

    • Compress and Decompress

    • Digits

    • Dir

    • Encrypt and Decrypt

    • HtmlEntities

    • Int

    • Null

    • NumberFormat

    • PregReplace

    • RealPath

    • StringToLower

    • StringToUpper

    • StringTrim

    • StripNewLines

    • StripTags

    • UriNormalize

  • Word Filters

    • CamelCaseToDash

    • CamelCaseToSeparator

    • CamelCaseToUnderscore

    • DashToCamelCase

    • DashToSeparator

    • DashToUnderscore

    • SeparatorToCamelCase

    • SeparatorToDash

    • SeparatorToSeparator

    • UnderscoreToCamelCase

    • UnderscoreToSeparator

    • UnderscoreToDash

  • File Filter Classes

    • Decrypt

    • Encrypt

    • Lowercase

    • Rename

    • RenameUpload

    • Uppercase

  • Filter Chains

    • Setting Filter Chain Order

    • Using the Plugin Manager

  • Zend\Filter\Inflector

    • Transforming MixedCase and camelCaseText to another format

    • Static Rules

    • Filter Inflector Rules

    • Setting Many Rules At Once

    • Example

  • Using the StaticFilter

  • Writing Filters

    • Example

  • Introduction

  • Quick Start

    • Programmatic Form Creation

    • Creation via Factory

    • Factory-backed Form Extension

    • Validating Forms

    • Hinting to the Input Filter

    • Binding an object

    • Rendering

    • Validation Groups

    • Using Annotations

  • Form Collections

    • Creating Fieldsets

    • The Form Element

    • The Controller

    • The View

    • Adding New Elements Dynamically

    • Validation groups for fieldsets and collection

  • File Uploading

    • Standard Example

    • File Post-Redirect-Get Plugin

    • HTML5 Multi-File Uploads

    • Upload Progress

    • Additional Info

  • Advanced use of forms

    • Short names

    • Creating custom elements

    • Handling dependencies

    • The specific case of initializers

  • Form Elements

    • Introduction

    • Element Base Class

    • Standard Elements

    • HTML5 Elements

  • Form View Helpers

    • Introduction

    • Standard Helpers

    • HTML5 Helpers

    • File Upload Progress Helpers

  • Zend\Http

    • Overview

    • Zend\Http Request, Response and Headers

  • The Request Class

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The Response Class

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The Headers Class

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Zend\Http\Header\HeaderInterface Methods

    • Zend\Http\Header\AbstractAccept Methods

    • Zend\Http\Header\AbstractDate Methods

    • Zend\Http\Header\AbstractLocation Methods

    • List of HTTP Header Types

    • Examples

  • HTTP Client

    • Overview

    • Quick Start

    • Configuration

    • Examples

  • HTTP Client - Connection Adapters

    • Overview

    • The Socket Adapter

    • The Proxy Adapter

    • The cURL Adapter

    • The Test Adapter

    • Creating your own connection adapters

  • HTTP Client - Advanced Usage

    • HTTP Redirections

    • Adding Cookies and Using Cookie Persistence

    • Setting Custom Request Headers

    • File Uploads

    • Sending Raw POST Data

    • HTTP Authentication

    • Sending Multiple Requests With the Same Client

    • Data Streaming

  • HTTP Client - Static Usage

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

  • Translating

    • Adding translations

    • Supported formats

    • Setting a locale

    • Translating messages

    • Caching

  • I18n View Helpers

    • Introduction

    • CurrencyFormat Helper

    • DateFormat Helper

    • NumberFormat Helper

    • Plural Helper

    • Translate Helper

    • TranslatePlural Helper

    • Abstract Translator Helper

  • I18n Filters

    • Alnum

    • Alpha

    • NumberFormat

    • NumberParse

  • I18n Validators

  • Float

    • Supported options for Zend\I18n\Validator\Float

    • Simple float validation

    • Localized float validation

    • Int

  • Introduction

  • File Upload Input

    • Basic Usage

  • Introduction

  • Basic Usage

    • Pretty-printing JSON

  • Advanced Usage

    • JSON Objects

    • Encoding PHP objects

    • Internal Encoder/Decoder

    • JSON Expressions

  • XML to JSON conversion

    • Example

  • Zend\Json\Server - JSON-RPC server

    • Introduction

    • Basic Usage

    • Advanced Details

  • Introduction to Zend\Ldap

    • Theory of operation

  • API overview

    • Configuration / options

    • API Reference

  • Zend\Ldap\Ldap

    • Zend\Ldap\Collection

  • Zend\Ldap\Attribute

  • Zend\Ldap\Converter\Converter

  • Zend\Ldap\Dn

  • Zend\Ldap\Filter

  • Zend\Ldap\Node

  • Zend\Ldap\Node\RootDse

    • OpenLDAP

    • ActiveDirectory

    • eDirectory

  • Zend\Ldap\Node\Schema

    • OpenLDAP

    • ActiveDirectory

  • Zend\Ldap\Ldif\Encoder

  • Usage Scenarios

    • Authentication scenarios

    • Basic CRUD operations

    • Extended operations

  • Tools

    • Creation and modification of DN strings

    • Using the filter API to create search filters

    • Modify LDAP entries using the Attribute API

  • Object-oriented access to the LDAP tree using Zend\Ldap\Node

    • Basic CRUD operations

    • Extended operations

    • Tree traversal

  • Getting information from the LDAP server

    • RootDSE

    • Schema Browsing

  • Serializing LDAP data to and from LDIF

    • Serialize a LDAP entry to LDIF

    • Deserialize a LDIF string into a LDAP entry

  • The AutoloaderFactory

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The StandardAutoloader

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The ClassMapAutoloader

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The ModuleAutoloader

    • Overview

    • Quickstart

    • Configuration Options

    • Available Methods

    • Examples

  • The SplAutoloader Interface

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The PluginClassLoader

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The ShortNameLocator Interface

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The PluginClassLocator interface

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • The Class Map Generator utility: bin/classmap_generator.php

    • Overview

    • Quick Start

    • Configuration Options

  • Zend\Log

    • Overview

    • Creating a Log

    • Logging Messages

    • Destroying a Log

    • Using Built-in Priorities

    • Understanding Log Events

    • Log PHP Errors

  • Writers

    • Writing to Streams

    • Writing to Databases

    • Writing to FirePHP

    • Stubbing Out the Writer

    • Testing with the Mock

    • Compositing Writers

  • Filters

    • Overview

    • Available filters

  • Formatters

    • Simple Formatting

    • Formatting to XML

    • Formatting to FirePhp

  • Introduction to Zend\Mail

    • Getting started

    • Configuring the default sendmail transport

  • Zend\Mail\Message

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Mail\Transport

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Mail\Transport\SmtpOptions

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Zend\Mail\Transport\FileOptions

    • Overview

    • Quick Start

    • Configuration Options

    • Available Methods

    • Examples

  • Introduction to Zend\Math

    • Random number generator

    • Big integers

  • Overview

    • Introduction

    • Theory of Operation

  • Memory Manager

    • Creating a Memory Manager

    • Managing Memory Objects

    • Memory Manager Settings

  • Memory Objects

    • Movable

    • Locked

    • Memory container `value' property

    • Memory container interface

  • Zend\Mime

    • Introduction

    • Static Methods and Constants

    • Instantiating Zend\Mime

  • Zend\Mime\Message

    • Introduction

    • Instantiation

    • Adding MIME Parts

    • Boundary handling

    • Parsing a string to create a Zend\Mime\Message object

    • Available methods

  • Zend\Mime\Part

    • Introduction

    • Instantiation

    • Methods for rendering the message part to a string

    • Available methods

  • Introduction to the Module System

    • The autoload_*.php Files

  • The Module Manager

    • Module Manager Events

    • Module Manager Listeners

  • The Module Class

    • A Minimal Module

    • A Typical Module Class

    • The ``loadModules.post'' Event

    • The MVC ``bootstrap'' Event

  • The Module Autoloader

    • Module Autoloader Usage

    • Non-Standard / Explicit Module Paths

    • Packaging Modules with Phar

  • Best Practices when Creating Modules

    • Keep the init() and onBootstrap() methods lightweight

    • Do not perform writes within a module

    • Utilize a vendor prefix for module names

    • Utilize a module prefix for service names

  • Introduction to the MVC Layer

    • Basic Application Structure

    • Basic Module Structure

    • Bootstrapping an Application

    • Bootstrapping a Modular Application

    • Conclusion

  • Quick Start

    • Install the Zend Skeleton Application

    • Create a New Module

    • Update the Module Class

    • Create a Controller

    • Create a View Script

    • Create a Route

    • Tell the Application About our Module

    • Test it Out!

  • Default Services

    • Theory of Operation

    • ServiceManager

    • Abstract Factories

    • Plugin Managers

    • ViewManager

    • Application Configuration Options

    • Default Configuration Options

  • Routing

    • Router Types

    • HTTP Route Types

    • HTTP Routing Examples

    • Console Route Types

  • The MvcEvent

    • Order of events

    • MvcEvent::EVENT_BOOTSTRAP

    • MvcEvent::EVENT_ROUTE

    • MvcEvent::EVENT_DISPATCH

    • MvcEvent::EVENT_DISPATCH_ERROR

    • MvcEvent::EVENT_RENDER

    • MvcEvent::EVENT_RENDER_ERROR

    • MvcEvent::EVENT_FINISH

  • The SendResponseEvent

    • Listeners

    • Triggerers

  • Available Controllers

    • Common Interfaces Used With Controllers

    • The AbstractActionController

    • The AbstractRestfulController

  • Controller Plugins

    • AcceptableViewModelSelector Plugin

    • FlashMessenger Plugin

    • Forward Plugin

    • Identity Plugin

    • Layout Plugin

    • Params Plugin

    • Post/Redirect/Get Plugin

    • File Post/Redirect/Get Plugin

    • Redirect Plugin

    • Url Plugin

  • Examples

    • Controllers

    • Bootstrapping

  • Introduction to Zend\Navigation

    • Pages and Containers

    • View Helpers

  • Quick Start

  • Pages

    • Common page features

    • Zend\Navigation\Page\Mvc

    • Zend\Navigation\Page\Uri

    • Creating custom page types

    • Creating pages using the page factory

  • Containers

    • Creating containers

    • Adding pages

    • Removing pages

    • Finding pages

    • Iterating containers

    • Other operations

  • View Helpers

    • Introduction

    • Translation of labels and titles

    • Integration with ACL

    • Navigation setup used in examples

  • View Helper - Breadcrumbs

    • Introduction

    • Basic usage

    • Specifying indentation

    • Customize output

    • Rendering using a partial view script

  • View Helper - Links

    • Introduction

    • Basic usage

  • View Helper - Menu

    • Introduction

    • Basic usage

    • Calling renderMenu() directly

    • Rendering the deepest active menu

    • Rendering with maximum depth

    • Rendering with minimum depth

    • Rendering only the active branch

    • Rendering only the active branch with minimum depth

    • Rendering only the active branch with maximum depth

    • Rendering only the active branch with maximum depth and no parents

    • Rendering a custom menu using a partial view script

  • View Helper - Sitemap

    • Introduction

    • Basic usage

    • Rendering using no ACL role

    • Rendering using a maximum depth

  • View Helper - Navigation Proxy

    • Introduction

    • Methods

  • Introduction to Zend\Paginator

  • Usage

    • Paginating data collections

    • The DbSelect adapter

    • Rendering pages with view scripts

  • Configuration

  • Advanced usage

    • Custom data source adapters

    • Custom scrolling styles

    • Caching features

  • Introduction to Zend\Permissions\Acl

    • Resources

    • Roles

    • Creating the Access Control List

    • Registering Roles

    • Defining Access Controls

    • Querying an ACL

  • Refining Access Controls

    • Precise Access Controls

    • Removing Access Controls

  • Advanced Usage

    • Storing ACL Data for Persistence

    • Writing Conditional ACL Rules with Assertions

  • Introduction to Zend\Permissions\Rbac

    • Roles

    • Permissions

    • Dynamic Assertions

  • Methods

  • Examples

    • Roles

    • Permissions

    • Dynamic Assertions

  • Progress Bars

    • Introduction

    • Basic Usage

    • Persistent Progress

    • Standard Adapters

  • File Upload Handlers

    • Introduction

    • Methods of Reporting Progress

    • Standard Handlers

  • Introduction to Zend\Serializer

    • Quick Start

    • Basic configuration Options

    • Available Methods

  • Zend\Serializer\Adapter

    • The PhpSerialize Adapter

    • The IgBinary Adapter

    • The Wddx Adapter

    • The Json Adapter

    • The PythonPickle Adapter

    • The PhpCode Adapter

  • Introduction to Zend\Server

  • Zend\Server\Reflection

    • Introduction

    • Usage

  • Zend\ServiceManager

  • Zend\ServiceManager Quick Start

    • Using Configuration

    • Modules as Service Providers

    • Examples

  • Delegator service factories

    • Delegator factory signature

    • A Delegator factory use case

  • Lazy Services

    • Use cases

    • Setup

    • Practical example

    • Configuration

  • Session Config

    • Standard Config

    • Session Config

    • Custom Configuration

  • Session Container

    • Basic Usage

    • Setting the Default Session Manager

  • Session Manager

    • Initializing the Session Manager

    • Session Compatibility

  • Session Save Handlers

    • Cache

    • DbTableGateway

    • MongoDB

    • Custom Save Handlers

  • Session Storage

    • Array Storage

    • Session Storage

    • Session Array Storage

    • Custom Storage

  • Session Validators

    • Http User Agent

    • Remote Addr

    • Custom Validators

  • Zend\Soap\Server

    • Zend\Soap\Server constructor

    • Methods to define Web Service API

    • Request and response objects handling

    • Document/Literal WSDL Handling

  • Zend\Soap\Client

    • Zend\Soap\Client Constructor

    • Performing SOAP Requests

  • WSDL Accessor

    • Zend\Soap\Wsdl constructor

    • addMessage() method

    • addPortType() method

    • addPortOperation() method

    • addBinding() method

    • addBindingOperation() method

    • addSoapBinding() method

    • addSoapOperation() method

    • addService() method

    • Type mapping

    • addDocumentation() method

    • Get finalized WSDL document

  • AutoDiscovery

    • AutoDiscovery Introduction

    • Class autodiscovering

    • Functions autodiscovering

    • Autodiscovering Datatypes

    • WSDL Binding Styles

  • Zend\Stdlib\Hydrator

    • HydratorInterface

    • Usage

    • Available Implementations

  • Zend\Stdlib\Hydrator\Filter

    • Filter implementations

    • Remove filters

    • Add filters

    • Use the composite for complex filters

    • Using the provider interface

  • Zend\Stdlib\Hydrator\Strategy

    • Adding strategies to the hydrators

    • Available implementations

    • Writing custom strategies

  • AggregateHydrator

    • Installation requirements

    • Basic usage

    • Advanced use cases

  • Introduction to Zend\Tag

  • Creating tag clouds with Zend\Tag\Cloud

    • Decorators

  • Introduction to Zend\Test

  • Unit testing with PHPUnit

  • Setup your TestCase

  • Testing your Controllers and MVC Applications

  • Assertions

  • Request Assertions

  • CSS Selector Assertions

  • XPath Assertions

  • Redirect Assertions

  • Response Header Assertions

  • Zend\Text\Figlet

    • Introduction

    • Basic Usage

  • Zend\Text\Table

    • Introduction

    • Basic Usage

  • Zend\Uri

    • Overview

    • Creating a New URI

    • Manipulating an Existing URI

    • Common Instance Methods

  • Introduction to Zend\Validator

    • What is a validator?

    • Basic usage of validators

    • Customizing messages

    • Translating messages

  • Standard Validation Classes

    • Alnum

  • Alpha

    • Supported options for Zend\I18n\Validator\Alpha

    • Basic usage

    • Using whitespaces

    • Using different languages

  • Barcode

    • Supported options for Zend\Validator\Barcode

    • Basic usage

    • Optional checksum

    • Writing custom adapters

  • Between

    • Supported options for Zend\Validator\Between

    • Default behaviour for Zend\Validator\Between

    • Validation exclusive the border values

  • Callback

    • Supported options for Zend\Validator\Callback

    • Basic usage

    • Usage with closures

    • Usage with class-based callbacks

    • Adding options

  • CreditCard

    • Supported options for Zend\Validator\CreditCard

    • Basic usage

    • Accepting defined credit cards

    • Validation by using foreign APIs

    • Ccnum

  • Date

    • Supported options for Zend\Validator\Date

    • Default date validation

    • Self defined date validation

  • Db\RecordExists and Db\NoRecordExists

    • Supported options for Zend\Validator\Db\*

    • Basic usage

    • Excluding records

    • Database Schemas

    • Using a Select object

  • Digits

    • Supported options for Zend\Validator\Digits

    • Validating digits

  • EmailAddress

    • Basic usage

    • Options for validating Email Addresses

    • Complex local parts

    • Validating only the local part

    • Validating different types of hostnames

    • Checking if the hostname actually accepts email

    • Validating International Domains Names

    • Validating Top Level Domains

    • Setting messages

  • File Validation Classes

    • Crc32

    • ExcludeExtension

    • ExcludeMimeType

    • Exists

    • Extension

    • Hash

    • ImageSize

    • IsCompressed

    • IsImage

    • Md5

    • MimeType

    • NotExists

    • Sha1

    • Size

    • UploadFile

    • WordCount

  • Float

    • Supported options for Zend\I18n\Validator\Float

    • Simple float validation

    • Localized float validation

  • GreaterThan

    • Supported options for Zend\Validator\GreaterThan

    • Basic usage

    • Validation inclusive the border value

  • Hex

    • Supported options for Zend\Validator\Hex

  • Hostname

    • Supported options for Zend\Validator\Hostname

    • Basic usage

    • Validating different types of hostnames

    • Validating International Domains Names

    • Validating Top Level Domains

  • Iban

    • Supported options for Zend\Validator\Iban

    • IBAN validation

  • Identical

    • Supported options for Zend\Validator\Identical

    • Basic usage

    • Identical objects

    • Form elements

    • Strict validation

    • Configuration

  • InArray

    • Supported options for Zend\Validator\InArray

    • Simple array validation

    • Array validation modes

    • Recursive array validation

  • Ip

    • Supported options for Zend\Validator\Ip

    • Basic usage

    • Validate IPv4 or IPV6 alone

  • Isbn

    • Supported options for Zend\Validator\Isbn

    • Basic usage

    • Setting an explicit ISBN validation type

    • Specifying a separator restriction

  • LessThan

    • Supported options for Zend\Validator\LessThan

    • Basic usage

    • Validation inclusive the border value

  • NotEmpty

    • Supported options for Zend\Validator\NotEmpty

    • Default behaviour for Zend\Validator\NotEmpty

    • Changing behaviour for Zend\Validator\NotEmpty

  • PostCode

    • Constructor options

    • Supported options for Zend\Validator\PostCode

  • Regex

    • Supported options for Zend\Validator\Regex

    • Validation with Zend\Validator\Regex

    • Pattern handling

  • Sitemap Validators

    • Sitemap\Changefreq

    • Sitemap\Lastmod

    • Sitemap\Loc

    • Sitemap\Priority

    • Supported options for Zend\Validator\Sitemap_*

  • Step

    • Supported options for Zend\Validator\Step

    • Basic usage

    • Using floating-point values

  • StringLength

    • Supported options for Zend\Validator\StringLength

    • Default behaviour for Zend\Validator\StringLength

    • Limiting the maximum allowed length of a string

    • Limiting the minimal required length of a string

    • Limiting a string on both sides

    • Encoding of values

  • File Validation Classes

    • Crc32

    • ExcludeExtension

    • ExcludeMimeType

    • Exists

    • Extension

    • Hash

    • ImageSize

    • IsCompressed

    • IsImage

    • Md5

    • MimeType

    • NotExists

    • Sha1

    • Size

    • UploadFile

    • WordCount

  • Validator Chains

    • Overview

  • Writing Validators

    • Overview

    • Creating a Simple Validation Class

    • Writing a Validation Class having Dependent Conditions

    • Validation with Independent Conditions, Multiple Reasons for Failure

  • Validation Messages

    • Using pre-translated validation messages

    • Limit the size of a validation message

  • Getting the Zend Framework Version

    • Overview

    • Example of the compareVersion() Method

    • Example of the getLatest() Method

  • Zend\View Quick Start

    • Overview

    • Usage

  • The PhpRenderer

    • Usage

    • Options and Configuration

    • Additional Methods

  • PhpRenderer View Scripts

    • Escaping Output

  • The ViewEvent

    • Order of events

    • ViewEvent::EVENT_RENDERER

    • ViewEvent::EVENT_RENDERER_POST

    • ViewEvent::EVENT_RESPONSE

  • View Helpers

    • Introduction

    • Included Helpers

  • View Helper - BasePath

    • Introduction

    • Basic Usage

  • View Helper - Cycle

    • Introduction

    • Basic Usage

    • Working with two or more cycles

  • View Helper - Doctype

    • Introduction

    • Basic Usage

    • Retrieving the Doctype

    • Choosing a Doctype to Use with the Open Graph Protocol

    • Zend MVC View Manager

  • FlashMessenger Helper

    • Introduction

    • Basic Usage

    • CSS Layout

    • HTML Layout

    • Sample Modification for Twitter Bootstrap 3

    • Alternative Configuration of the ViewHelper Layout

  • Gravatar Helper

    • Introduction

    • Basic Usage

    • Custom Settings

  • View Helper - HeadLink

    • Introduction

    • Basic Usage

  • View Helper - HeadMeta

    • Introduction

    • Basic Usage

    • Usage with XHTML1_RDFA doctype

  • View Helper - HeadScript

    • Introduction

    • Basic Usage

    • Capturing Scripts

  • View Helper - HeadStyle

    • Introduction

    • Basic Usage

    • Capturing Style Declarations

  • View Helper - HeadTitle

    • Introduction

    • Basic Usage

  • View Helper - HtmlList

    • Introduction

    • Basic Usage

  • View Helper - HTML Object

    • Introduction

    • Flash helper

    • Customizing the object by passing additional arguments

  • View Helper - Identity

    • Introduction

    • Basic Usage

    • Using with ServiceManager

  • View Helper - InlineScript

    • Introduction

    • Basic Usage

    • Capturing Scripts

  • View Helper - JSON

    • Introduction

    • Basic Usage

  • View Helper - Partial

    • Introduction

    • Basic Usage

    • Using PartialLoop to Render Iterable Models

  • View Helper - Placeholder

    • Introduction

    • Basic Usage

    • Aggregate Content

    • Capture Content

    • Concrete Implementations

  • View Helper - URL

    • Basic Usage

    • Query String Arguments

    • Fragments

    • Reusing Matched Parameters

  • Advanced usage of helpers

    • Registering Helpers

    • Writing Custom Helpers

    • Registering Concrete Helpers

  • Introduction to Zend\XmlRpc

    • Quick Start

  • Zend\XmlRpc\Client

    • Introduction

    • Method Calls

    • Types and Conversions

    • Server Proxy Object

    • Error Handling

    • Server Introspection

    • From Request to Response

    • HTTP Client and Testing

  • Zend\XmlRpc\Server

    • Introduction

    • Basic Usage

    • Server Structure

    • Anatomy of a webservice

    • Conventions

    • Utilizing Namespaces

    • Custom Request Objects

    • Custom Responses

    • Handling Exceptions via Faults

    • Caching Server Definitions Between Requests

    • Usage Examples

    • Performance optimization

  • ZendService\Akismet

    • Introduction

    • Verify an API key

    • Check for spam

    • Submitting known spam

    • Submitting false positives (ham)

    • Zend-specific Methods

  • ZendService\Amazon

    • Introduction

    • Country Codes

    • Looking up a Specific Amazon Item by ASIN

    • Performing Amazon Item Searches

    • Using the Alternative Query API

    • ZendService\Amazon Classes

  • ZendService\Amazon\S3

    • Introduction

    • Registering with Amazon S3

    • API Documentation

    • Features

    • Getting Started

    • Bucket operations

    • Object operations

    • Data Streaming

    • Stream wrapper

  • ZendService\Amazon\Sqs

    • Introduction

    • Registering with Amazon SQS

    • API Documentation

    • Features

    • Getting Started

    • Queue operations

    • Message operations

  • ZendService\Amazon\Ec2

    • Introduction

    • What is Amazon Ec2?

    • Static Methods

  • ZendService\Amazon\Ec2: CloudWatch Monitoring

    • CloudWatch Usage

  • ZendService\Amazon\Ec2: Elastic Block Storage (EBS)

    • Create EBS Volumes and Snapshots

    • Describing EBS Volumes and Snapshots

    • Attach and Detaching Volumes from Instances

    • Deleting EBS Volumes and Snapshots

  • ZendService\Amazon\Ec2: Elastic IP Addresses

    • Allocating a new Elastic IP

  • ZendService\Amazon\Ec2: Instances

    • Instance Types

    • Running Amazon EC2 Instances

    • Amazon Instance Utilities

  • ZendService\Amazon\Ec2: Regions and Availability Zones

    • Amazon EC2 Regions

    • Amazon EC2 Availability Zones

  • ZendService\Amazon\Ec2: Reserved Instances

    • How Reserved Instances are Applied

    • Reserved Instances Usage

  • ZendService\Amazon\Ec2: Security Groups

    • Security Group Maintenance

    • Authorizing Access

    • Revoking Access

  • ZendService\Amazon\Ec2: Windows Instances

    • Windows Instances Usage

  • ZendService\Apple\Apns

    • Introduction

    • Quick Start

    • Feedback Service

  • ZendService\Audioscrobbler

    • Introduction

    • Users

    • Artists

    • Tracks

    • Tags

    • Groups

    • Forums

  • ZendService\Delicious

    • Introduction

    • Retrieving posts

    • ZendService\Delicious\PostList

    • Editing posts

    • Deleting posts

    • Adding new posts

    • Tags

    • Bundles

    • Public data

    • HTTP client

  • ZendService\DeveloperGarden

    • Introduction

    • BaseUserService

    • IP Location

    • Local Search

    • Send SMS

    • SMS Validation

    • Voice Call

    • ConferenceCall

    • Performance and Caching

  • ZendService\Flickr

    • Introduction

    • Finding Flickr Users' Photos and Information

    • Finding photos From a Group Pool

    • Retrieving Flickr Image Details

    • ZendService\Flickr Result Classes

  • ZendService\Google\Gcm

    • Introduction

    • Quick Start

  • ZendService\LiveDocx

    • Introduction

    • ZendService\LiveDocx\MailMerge

  • ZendService\Rackspace

    • Introduction

    • Registering with Rackspace

    • Cloud Files

    • Cloud Servers

    • Available Methods

  • ZendService\Rackspace\Servers

    • Overview

    • Terminology

    • Quick Start

    • Available Methods

    • Examples

  • ZendService\Rackspace\Files

    • Overview

    • Quick Start

    • Available Methods

    • Examples

  • ZendService\ReCaptcha

    • Introduction

    • Simplest use

    • Hiding email addresses

  • ZendService\SlideShare

    • Getting Started with ZendService\SlideShare

    • The SlideShow object

    • Retrieving a single slide show

    • Retrieving Groups of Slide Shows

    • ZendService\SlideShare Caching policies

    • Changing the behavior of the HTTP Client

  • ZendService\StrikeIron

    • Overview

    • Registering with StrikeIron

    • Getting Started

    • Making Your First Query

    • Examining Results

    • Handling Errors

    • Checking Your Subscription

  • ZendService\StrikeIron: Bundled Services

    • ZIP Code Information

    • U.S. Address Verification

    • Sales & Use Tax Basic

  • ZendService\StrikeIron: Advanced Uses

    • Using Services by WSDL

    • Viewing SOAP Transactions

  • ZendService\Technorati

    • Introduction

    • Getting Started

    • Making Your First Query

    • Consuming Results

    • Handling Errors

    • Checking Your API Key Daily Usage

    • Available Technorati Queries

    • ZendService\Technorati Classes

  • ZendService\Twitter

    • Introduction

    • Quick Start

    • Authentication

    • Account Methods

    • Application Methods

    • Blocking Methods

    • Direct Message Methods

    • Favorites Methods

    • Friendship Methods

    • Search Methods

    • Status Methods

    • User Methods

  • ZendService\WindowsAzure

    • Introduction

    • Installing the Windows Azure SDK

    • API Documentation

    • Features

    • Architecture

  • ZendService\WindowsAzure\Storage\Blob

    • API Examples

    • Root container

    • Blob storage stream wrapper

    • Shared Access Signature

  • ZendService\WindowsAzure\Storage\Table

    • Operations on tables

    • Operations on entities

    • Table storage session handler

  • ZendService\WindowsAzure\StorageQueue

    • API Examples

  • Copyright Information

  • Introduction to Zend Framework 2

  • User Guide

  • Getting Started With Zend Studio 10 & Zend Server 6

  • Zend Framework Tool (ZFTool)

  • Learning Zend Framework 2

  • Migration

  • Zend Framework 2 Reference

    • Zend\Authentication

    • Zend\Barcode

    • Zend\Cache

    • Zend\Captcha

    • Zend\Code\Generator

    • Zend\Config

    • Zend\Console

    • Zend\Console\Getopt

    • Zend\Crypt

    • Zend\Db

    • Zend\Debug

    • Zend\Di

    • Zend\Dom

    • Zend\Escaper

    • Zend\EventManager

    • Zend\Exception

    • Zend\Feed

    • Zend\File

    • Zend\Filter

    • Zend\Form

    • Zend\Http

    • Zend\I18n

    • Zend\InputFilter

    • Zend\Json

    • Zend\Ldap

    • Zend\Loader

    • Zend\Log

    • Zend\Mail

    • Zend\Math

    • Zend\Memory

    • Zend\Mime

    • Zend\ModuleManager

    • Zend\Mvc

    • Zend\Navigation

    • Zend\Paginator

    • Zend\Permissions\Acl

    • Zend\Permissions\Rbac

    • Zend\ProgressBar

    • Zend\Serializer

    • Zend\Server

    • Zend\ServiceManager

    • Zend\Session

    • Zend\Soap

    • Zend\Stdlib

    • Zend\Tag

    • Zend\Test

    • Zend\Text

    • Zend\Uri

    • Zend\Validator

    • Zend\Version

    • Zend\View

    • Zend\XmlRpc

  • Services for Zend Framework 2 Reference

    • ZendService\Akismet

    • ZendService\Amazon

    • ZendService\AppleApns

    • ZendService\Audioscrobbler

    • ZendService\Delicious

    • ZendService\DeveloperGarden

    • ZendService\Flickr

    • ZendService\Google\Gcm

    • ZendService\LiveDocx

    • ZendService\Rackspace

    • ZendService\ReCaptcha

    • ZendService\SlideShare

    • ZendService\StrikeIron

    • ZendService\Technorati

    • ZendService\Twitter

    • ZendService\WindowsAzure

  • Copyright

  • Indices and tables

Nội dung

Tài liệu tham khảo lập trình Zend Framework 2.3.1

Zend Framework 2 Documentation Release 2.3.1 Zend Technologies Ltd. April 15, 2014 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3 Error reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 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 23 9 Forms and actions 25 9.1 Adding new albums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 9.2 Editing an album . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 9.3 Deleting an album . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 9.4 Ensuring that the home page displays the list of albums . . . . . . . . . . . . . . . . . . . . . . . . . 34 10 Conclusion 35 i 11 Getting Started with Zend Framework 2 37 11.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 11.2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 12 A quick tour of the skeleton application 43 12.1 The dispatch cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 13 The MyTaskList application 47 13.1 The Checklist module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 13.2 The Module class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 14 The application’s pages 51 14.1 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 14.2 The TaskController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 14.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 14.4 Using Service Manager to configure the database credentials and inject into the controller . . . . . . 56 15 Listing tasks 59 15.1 Redirect the home page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 16 Styling 63 17 Adding new tasks 65 18 Editing a task 71 19 Deleting a task 75 20 Application Diagnostics 77 21 Step-by-step debugging 79 22 Conclusion 81 23 Zend Framework Tool (ZFTool) 83 23.1 Installation using Composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 23.2 Manual installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 23.3 Without installation, using the PHAR file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 23.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 24 Learning Dependency Injection 87 24.1 Very brief introduction to Di. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 24.2 Simplest usage case (2 classes, one consumes the other) . . . . . . . . . . . . . . . . . . . . . . . . 87 24.3 Simplest Usage Case Without Type-hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 24.4 Simplest usage case with Compiled Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 24.5 Creating a precompiled definition for others to use . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 24.6 Using Multiple Definitions From Multiple Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 24.7 Generating Service Locators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 25 Unit Testing a Zend Framework 2 application 97 25.1 Setting up the tests directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 25.2 Bootstrapping your tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 25.3 Your first controller test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 25.4 A failing test case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 25.5 Configuring the service manager for the tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 25.6 Testing actions with POST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 ii 25.7 Testing model entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 25.8 Testing model tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 25.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 26 Using the EventManager 111 26.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 26.2 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 26.3 Shared managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 27 Wildcards 115 28 Listener aggregates 117 28.1 Introspecting results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 28.2 Short-circuiting listener execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 28.3 Keeping it in order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 28.4 Custom event objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 28.5 Putting it together: Implementing a simple caching system . . . . . . . . . . . . . . . . . . . . . . . 121 28.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 29 Advanced Configuration Tricks 125 29.1 System configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 29.2 Module Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 29.3 Configuration mapping table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 29.4 Configuration Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 29.5 Manipulating merged configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 29.6 Configuration merging workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 30 Using Zend\Navigation in your Album Module 133 30.1 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 30.2 Setting Up Zend\Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 30.3 Configuring our Site Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 30.4 Adding the Menu View Helper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 30.5 Adding Breadcrumbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 31 Using Zend\Paginator in your Album Module 137 31.1 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 31.2 Modifying the AlbumTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 31.3 Modifying the AlbumController . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 31.4 Updating the View Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 31.5 Creating the Pagination Control Partial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 32 Using the PaginationControl View Helper 145 33 Setting up a database adapter 147 33.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 33.2 Basic setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 33.3 Setting a static adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 34 Migration from Zend Framework 1 149 35 Namespacing Old Classes 151 35.1 Namespacing a ZF1 Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 35.2 HOWTO Namespace Your Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 36 Running Zend Framework 2 and Zend Framework 1 in parallel 155 36.1 Use ZF2 in a ZF1 project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 iii 36.2 Use ZF1 in a ZF2 project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 36.3 Run ZF1 and ZF2 together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 37 Introduction to Zend\Authentication 159 37.1 Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 37.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 37.3 Identity Persistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 37.4 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 38 Database Table Authentication 167 38.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 38.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 38.3 Advanced Usage: Persisting a DbTable Result Object . . . . . . . . . . . . . . . . . . . . . . . . . . 170 39 Digest Authentication 173 39.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 39.2 Specifics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 39.3 Identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 40 HTTP Authentication Adapter 175 40.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 40.2 Design Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 40.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 40.4 Resolvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 40.5 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 41 LDAP Authentication 179 41.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 41.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 41.3 The API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 41.4 Server Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 41.5 Collecting Debugging Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 41.6 Common Options for Specific Servers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 42 Authentication Validator 187 42.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 42.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 43 Introduction to Zend\Barcode 189 44 Barcode creation using Zend\Barcode\Barcode class 191 44.1 Using Zend\Barcode\Barcode::factory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 44.2 Drawing a barcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 44.3 Rendering a barcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 45 Zend\Barcode\Barcode Objects 195 45.1 Common Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 45.2 Common Additional Getters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 45.3 Description of shipped barcodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 46 Zend\Barcode Renderers 205 46.1 Common Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 46.2 Zend\Barcode\Renderer\Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 46.3 Zend\Barcode\Renderer\Pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 iv 47 Zend\Cache\Storage\Adapter 207 47.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 47.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 47.3 Basic Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 47.4 The StorageInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 47.5 The AvailableSpaceCapableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 47.6 The TotalSpaceCapableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 47.7 The ClearByNamespaceInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 47.8 The ClearByPrefixInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 47.9 The ClearExpiredInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 47.10 The FlushableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 47.11 The IterableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 47.12 The OptimizableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 47.13 The TaggableInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 47.14 The Apc Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 47.15 The Dba Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 47.16 The Filesystem Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 47.17 The Memcached Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 47.18 The Memory Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 47.19 The WinCache Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 47.20 The XCache Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 47.21 The ZendServerDisk Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 47.22 The ZendServerShm Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 47.23 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 48 Zend\Cache\Storage\Capabilities 223 48.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 48.2 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 48.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 49 Zend\Cache\Storage\Plugin 227 49.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 49.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 49.3 The ClearExpiredByFactor Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 49.4 The ExceptionHandler Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 49.5 The IgnoreUserAbort Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 49.6 The OptimizeByFactor Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 49.7 The Serializer Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 49.8 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 49.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 50 Zend\Cache\Pattern 231 50.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 50.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 50.3 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 51 Zend\Cache\Pattern\CallbackCache 233 51.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 51.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 51.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 51.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 51.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 52 Zend\Cache\Pattern\ClassCache 235 52.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 v 52.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 52.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 52.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 52.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 53 Zend\Cache\Pattern\ObjectCache 239 53.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 53.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 53.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 53.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 53.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 54 Zend\Cache\Pattern\OutputCache 243 54.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 54.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 54.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 54.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 54.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 55 Zend\Cache\Pattern\CaptureCache 245 55.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 55.2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 55.3 Configuration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 55.4 Available Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 55.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 56 Introduction to Zend\Captcha 249 56.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 57 Captcha Operation 251 57.1 The AdapterInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 57.2 Basic Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 58 CAPTCHA Adapters 253 58.1 Zend\Captcha\AbstractWord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 58.2 Zend\Captcha\Dumb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 58.3 Zend\Captcha\Figlet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 58.4 Zend\Captcha\Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 58.5 Zend\Captcha\ReCaptcha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 59 Introduction 257 59.1 Theory of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 60 ZendCodeGenerator Reference 261 60.1 Abstract Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 60.2 Concrete CodeGenerator Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 61 ZendCodeGenerator Examples 269 62 Introduction to Zend\Config 277 62.1 Using Zend\Config\Config with a Reader Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 62.2 Using Zend\Config\Config with a PHP Configuration File . . . . . . . . . . . . . . . . . . . . . . . 278 63 Theory of Operation 279 vi 64 Zend\Config\Reader 281 64.1 Zend\Config\Reader\Ini . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 64.2 Zend\Config\Reader\Xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 64.3 Zend\Config\Reader\Json . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 64.4 Zend\Config\Reader\Yaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 65 Zend\Config\Writer 287 65.1 Zend\Config\Writer\Ini . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 65.2 Zend\Config\Writer\Xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 65.3 Zend\Config\Writer\PhpArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 65.4 Zend\Config\Writer\Json . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 65.5 Zend\Config\Writer\Yaml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 66 Zend\Config\Processor 293 66.1 Zend\Config\Processor\Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 66.2 Zend\Config\Processor\Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 66.3 Zend\Config\Processor\Queue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 66.4 Zend\Config\Processor\Token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 66.5 Zend\Config\Processor\Translator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 67 The Factory 297 67.1 Loading configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 67.2 Storing configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 68 Introduction to Zend\Console 299 68.1 Writing console routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 68.2 Handling console requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 68.3 Adding console usage info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 69 Console routes and routing 305 69.1 Router configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 69.2 Basic route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 69.3 Catchall route . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 69.4 Console routes cheat-sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 70 Console-aware modules 313 70.1 Application banner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 70.2 Basic usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 70.3 Best practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 71 Console-aware action controllers 323 71.1 Handling console requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 71.2 Sending output to console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 71.3 Are we in a console? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 71.4 Reading values from console parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 72 Console adapters 331 72.1 Retrieving console adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 72.2 Using console adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 73 Console prompts 335 73.1 Confirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 73.2 Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 73.3 Char . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 73.4 Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 vii 74 ZendConsoleGetopt 341 74.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 75 Declaring Getopt Rules 343 75.1 Declaring Options with the Short Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 75.2 Declaring Options with the Long Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 76 Fetching Options and Arguments 345 76.1 Handling Getopt Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 76.2 Fetching Options by Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 76.3 Reporting Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 76.4 Fetching Non-option Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 77 Configuring Zend\Console\Getopt 349 77.1 Adding Option Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 77.2 Adding Help Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 77.3 Adding Option Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 77.4 Adding Argument Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 77.5 Adding Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 78 Introduction to Zend\Crypt 353 79 Encrypt/decrypt using block ciphers 355 80 Key derivation function 357 80.1 Pbkdf2 adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 80.2 SaltedS2k adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 80.3 Scrypt adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 81 Password 361 81.1 Bcrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 81.2 Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 82 Public key cryptography 365 82.1 Diffie-Hellman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 82.2 RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 83 Zend\Db\Adapter 371 83.1 Creating an Adapter - Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 83.2 Creating an Adapter Using Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 83.3 Query Preparation Through Zend\Db\Adapter\Adapter::query() . . . . . . . . . . . . . . . . . . . . 372 83.4 Query Execution Through Zend\Db\Adapter\Adapter::query() . . . . . . . . . . . . . . . . . . . . . 373 83.5 Creating Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 83.6 Using the Driver Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 83.7 Using The Platform Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 83.8 Using The Parameter Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 83.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 84 Zend\Db\ResultSet 379 84.1 Quickstart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 84.2 Zend\Db\ResultSet\ResultSet and Zend\Db\ResultSet\AbstractResultSet . . . . . . . . . . . . . . . . 380 84.3 Zend\Db\ResultSet\HydratingResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 85 Zend\Db\Sql 383 85.1 Zend\Db\Sql\Sql (Quickstart) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 85.2 Zend\Db\Sql’s Select, Insert, Update and Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 viii [...]... 23 4Introduction to Zend\Server 11 11 111 1 11 11 111 1 11 12 11 12 11 13 11 15 23 5Zend\Server\Reflection 11 17 23 5 .1 Introduction 11 17 23 5 .2 Usage 11 17 23 6Zend\ServiceManager 11 19 23 7Zend\ServiceManager Quick Start 1 1 23 23 7 .1 Using Configuration 1 1 23 23 7 .2 Modules... 5 21 5 21 522 5 23 5 23 526 527 5 32 533 533 539 5 41 xi 12 1 .12 Null 12 1 .13 NumberFormat 12 1 .14 PregReplace 12 1 .15 RealPath 12 1 .16 StringToLower 12 1 .17 StringToUpper 12 1 .18 StringTrim 12 1 .19 StripNewLines 12 1 .20 StripTags 12 1 . 21 UriNormalize ... 12 6 1 12 6 1 12 6 1 12 6 2 12 6 2 12 6 2 12 6 2 12 6 3 12 6 4 12 6 4 28 0File Validation Classes 28 0 .1 Crc 32 28 0 .2 ExcludeExtension 28 0 .3 ExcludeMimeType 28 0.4 Exists 28 0.5 Extension 28 0.6 Hash 28 0.7 ImageSize 28 0.8 IsCompressed 28 0.9 IsImage 28 0 .10 Md5 28 0 .11 MimeType 28 0 .12 NotExists 28 0 .13 Sha1 28 0 .14 Size 28 0 .15 UploadFile 28 0 .16 WordCount... 13 1 9 13 1 9 1 32 0 1 32 0 1 32 0 1 32 1 1 32 2 1 32 3 1 32 4 1 32 4 1 32 5 1 32 5 1 32 7 1 32 7 1 32 8 1 32 9 1 32 9 29 8Validator Chains 13 3 1 29 8 .1 Overview... 13 7 7 13 7 7 13 7 7 13 7 7 13 7 8 13 7 8 13 7 9 31 1Gravatar Helper 13 8 1 31 1. 1 Introduction 13 8 1 31 1 .2 Basic Usage 13 8 1 31 1 .3 Custom Settings 13 8 1 31 2View Helper - HeadLink 13 8 5 3 12 . 1 Introduction 13 8 5 3 12 . 2 Basic... 1 13 3 1 13 3 1 13 3 1 13 3 1 13 5 24 0Session Config 1 13 7 24 0 .1 Standard Config 1 13 7 24 0 .2 Session Config 1 13 8 24 0 .3 Custom Configuration 1 13 9 xxiii 24 1Session Container 11 41 24 1. 1 Basic Usage 11 41 24 1 .2 Setting the Default... 13 1 1 13 1 1 13 1 1 13 12 13 12 13 12 295Step 13 1 3 29 5 .1 Supported options for Zend\Validator\Step 13 1 3 29 5 .2 Basic usage 13 1 3 xxviii 29 5 .3 Using floating-point values 13 1 3 29 6StringLength 29 6 .1 Supported options for Zend\Validator\StringLength 29 6 .2 Default behaviour for... 5 41 5 43 544 544 545 546 547 547 548 549 12 2 Word Filters 12 2 .1 CamelCaseToDash 12 2 .2 CamelCaseToSeparator 12 2 .3 CamelCaseToUnderscore 12 2 .4 DashToCamelCase 12 2 .5 DashToSeparator 12 2 .6 DashToUnderscore 12 2 .7 SeparatorToCamelCase 12 2 .8 SeparatorToDash 12 2 .9 SeparatorToSeparator 12 2 .10 UnderscoreToCamelCase 12 2 .11 UnderscoreToSeparator 12 2 .12 UnderscoreToDash ... 517 517 517 518 518 12 1 Standard Filter Classes 12 1 .1 Alnum 12 1 .2 Alpha 12 1 .3 BaseName 12 1 .4 Boolean 12 1 .5 Callback 12 1 .6 Compress and Decompress 12 1 .7 Digits 12 1 .8 Dir 12 1 .9 Encrypt and Decrypt 12 1 .10 HtmlEntities 12 1 .11 Int ... 10 13 10 13 10 19 1 020 1 0 21 1 0 23 1 0 23 21 4View Helpers 21 4 .1 Introduction 21 4 .2 Translation of labels and titles 21 4 .3 Integration with ACL 21 4.4 Navigation setup used in examples 1 027 1 027 1 028 1 029 1 029 21 5View Helper - Breadcrumbs 21 5.1 . . . . . . . . . . . . . 33 2 73 Console prompts 33 5 73. 1 Confirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 6 73. 2 Line . . . . . . . . . . . . . . . . . . . . . . . . 633 133 .2 Element Base Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 133 .3 Standard Elements . . . . . . . . . . . . . . . . . 629 132 .4 The specific case of initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 133 Form Elements 633 133 .1 Introduction . . . .

Ngày đăng: 17/05/2014, 17:16

TỪ KHÓA LIÊN QUAN

w