Zend Framework 2
  • Overview
  • Installation
  • Getting Started with Zend Framework 2
    • Some assumptions
    • The tutorial application
  • Getting started: A skeleton application
    • Virtual host
    • Error reporting
  • Modules
    • Setting up the Album module
    • Configuration
    • Informing the application about our new module
  • 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
  • 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-ciruiting 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
    • 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\Object\Error
    • Zend\Barcode\Object\Code128
    • Zend\Barcode\Object\Codabar
    • Zend\Barcode\Object\Code25
    • Zend\Barcode\Object\Code25interleaved
    • Zend\Barcode\Object\Ean2
    • Zend\Barcode\Object\Ean5
    • Zend\Barcode\Object\Ean8
    • Zend\Barcode\Object\Ean13
    • Zend\Barcode\Object\Code39
    • Zend\Barcode\Object\Identcode
    • Zend\Barcode\Object\Itf14
    • Zend\Barcode\Object\Leitcode
    • Zend\Barcode\Object\Planet
    • Zend\Barcode\Object\Postnet
    • Zend\Barcode\Object\Royalmail
    • Zend\Barcode\Object\Upca
    • Zend\Barcode\Object\Upce
  • 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
  • Captcha Operation
  • CAPTCHA Adapters
    • Zend\Captcha\AbstractWord
    • Zend\Captcha\Dumb
    • Zend\Captcha\Figlet
    • Zend\Captcha\Image
    • Zend\Captcha\ReCaptcha
  • 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
    • Usage information
    • 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
  • 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
  • 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
  • Introduction to Zend\Feed
  • Importing Feeds
    • Dumping the contents of a feed
  • Retrieving Feeds from Web Pages
  • Consuming an RSS Feed
  • Consuming an Atom Feed
  • Consuming a Single Atom Entry
  • 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
    • Operation
    • Using Custom Filters
    • Setting the Inflector Target
    • Inflection Rules
    • Utility Methods
    • Using a Traversable or an array with Zend\Filter\Inflector
  • Writing Filters
  • Introduction to Zend\Form
  • Form 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
  • Overview of 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\* Base Methods
    • List of HTTP Header Types
    • Examples
  • HTTP Client - Overview
    • Overview
    • Quick Start
    • Configuration Options
    • Available Methods
    • 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
    • Supported options for Zend\I18n\Validator\Int
    • Simple integer validation
    • Localized integer validation
  • Introduction to Zend\InputFilter
  • File Upload Input
  • Introduction to Zend\Json
  • Basic Usage
    • Pretty-printing JSON
  • Advanced Usage of Zend\Json
    • JSON Objects
    • Encoding PHP objects
    • Internal Encoder/Decoder
    • JSON Expressions
  • XML to JSON conversion
  • Zend\Json\Server - JSON-RPC server
    • 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
  • Overview of Zend\Log
    • 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
    • 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
  • 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
  • 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
    • Translation of labels and titles
    • Integration with ACL
    • Navigation setup used in examples
  • View Helper - Breadcrumbs
  • View Helper - Links
  • View Helper - Menu
  • View Helper - Sitemap
  • View Helper - Navigation Proxy
  • 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
    • Basic Configuration Options
  • Basic Usage
  • Session Config
    • Basic Configuration Options
  • Basic Usage
    • Custom Configuration
  • Session Container
    • Basic Usage
    • Setting the Default Session Manager
  • Session Manager
    • Initializing the Session Manager
    • Session Compatibility
  • Session Save Handlers
  • Cache
    • Basic usage
  • DbTableGateway
    • Creating the database table
    • Basic usage
  • MongoDB
    • Basic Usage
    • Custom Save Handlers
  • Session Storage
  • Array Storage
    • Basic Usage
  • Session Storage
    • Basic Usage
  • Session Array Storage
    • Basic Usage
    • Custom Storage
  • Session Validators
  • Http User Agent
    • Basic Usage
  • Remote Addr
    • Basic Usage
    • 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
  • Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator
    • Installation requirements for the AggregateHydrator
    • Example of AggregateHydrator usage
    • Advanced use cases of the AggregateHydrator
  • 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
  • Zend\Text\Table
  • 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
    • Supported options for ZendI18nValidatorAlnum
    • Basic usage
    • Using whitespaces
    • Using different languages
  • Alpha
    • Supported options for Zend\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
    • Localized 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
  • 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
  • Writing Validators
  • Validation Messages
    • Using pre-translated validation messages
    • Limit the size of a validation message
  • Getting the Zend Framework Version
  • Zend\View Quick Start
  • Overview
  • Usage
    • Configuration
    • Controllers and View Models
    • Nesting View Models
    • Dealing with Layouts
    • Creating and Registering Alternate Rendering and Response Strategies
  • 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
  • Included Helpers
  • View Helper - Cycle
  • View Helper - Doctype
  • View Helper - Identity
  • View Helper - JSON
  • View Helper - Partial
  • View Helper - Placeholder
    • Concrete Placeholder Implementations
  • View Helper - URL
  • 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
  • ZendServiceAkismet
    • Introduction
    • Verify an API key
    • Check for spam
    • Submitting known spam
    • Submitting false positives (ham)
    • Zend-specific Methods
  • ZendServiceAmazon
    • Introduction
    • Country Codes
    • Looking up a Specific Amazon Item by ASIN
    • Performing Amazon Item Searches
    • Using the Alternative Query API
    • ZendServiceAmazon Classes
  • ZendService\Apple\Apns
    • Introduction
    • Quick Start
    • Feedback Service
  • ZendServiceAudioscrobbler
    • Introduction
    • Users
    • Artists
    • Tracks
    • Tags
    • Groups
    • Forums
  • ZendServiceDelicious
    • Introduction
    • Retrieving posts
    • ZendServiceDeliciousPostList
    • Editing posts
    • Deleting posts
    • Adding new posts
    • Tags
    • Bundles
    • Public data
    • HTTP client
  • Zend_Service_DeveloperGarden
    • Introduction to DeveloperGarden
    • BaseUserService
    • IP Location
    • Local Search
    • Send SMS
    • SMS Validation
    • Voice Call
    • ConferenceCall
    • Performance and Caching
  • ZendServiceFlickr
    • Introduction
    • Finding Flickr Users’ Photos and Information
    • Finding photos From a Group Pool
    • Retrieving Flickr Image Details
    • ZendServiceFlickr Result Classes
  • ZendService\LiveDocx
    • Introduction to LiveDocx
    • ZendService\LiveDocx\MailMerge
  • ZendServiceNirvanix
    • Introduction
    • Registering with Nirvanix
    • API Documentation
    • Features
    • Getting Started
    • Understanding the Proxy
    • Examining Results
    • Handling Errors
  • Zend\Service\Rackspace
    • Introduction
    • Registering with Rackspace
    • Cloud Files
    • Cloud Servers
    • Available Methods
  • ZendServiceReCaptcha
    • Introduction
    • Simplest use
    • Hiding email addresses
  • ZendServiceSlideShare
    • Getting Started with ZendServiceSlideShare
    • The SlideShow object
    • Retrieving a single slide show
    • Retrieving Groups of Slide Shows
    • ZendServiceSlideShare Caching policies
    • Changing the behavior of the HTTP Client
  • ZendServiceStrikeIron
    • Overview
    • Registering with StrikeIron
    • Getting Started
    • Making Your First Query
    • Examining Results
    • Handling Errors
    • Checking Your Subscription
  • ZendServiceTechnorati
    • Introduction
    • Getting Started
    • Making Your First Query
    • Consuming Results
    • Handling Errors
    • Checking Your API Key Daily Usage
    • Available Technorati Queries
    • ZendServiceTechnorati Classes
  • ZendServiceTwitter
    • Introduction
    • Quick Start
    • Authentication
    • Account Methods
    • Application Methods
    • Blocking Methods
    • Direct Message Methods
    • Favorites Methods
    • Friendship Methods
    • Search Methods
    • Status Methods
    • User Methods
  • ZendServiceWindowsAzure
    • Introduction
    • Installing the Windows Azure SDK
    • API Documentation
    • Features
    • Architecture
  • ZendServiceWindowsAzureStorageBlob
    • API Examples
    • Root container
    • Blob storage stream wrapper
    • Shared Access Signature
  • ZendServiceWindowsAzureStorageTable
    • Operations on tables
    • Operations on entities
    • Table storage session handler
  • ZendServiceWindowsAzureStorageQueue
    • API Examples
  • Copyright Information
 
Zend Framework 2
  • Docs »
  • View Helper - Links
  • Edit on GitHub

View Helper - LinksΒΆ

The links helper is used for rendering HTML LINK elements. Links are used for describing document relationships of the currently active page. Read more about links and link types at Document relationships: the LINK element (HTML4 W3C Rec.) and Link types (HTML4 W3C Rec.) in the HTML4 W3C Recommendation.

There are two types of relations; forward and reverse, indicated by the kewyords ‘rel’ and ‘rev’. Most methods in the helper will take a $rel param, which must be either ‘rel’ or ‘rev’. Most methods also take a $type param, which is used for specifying the link type (e.g. alternate, start, next, prev, chapter, etc).

Relationships can be added to page objects manually, or found by traversing the container registered in the helper. The method findRelation($page, $rel, $type) will first try to find the given $rel of $type from the $page by calling $page->findRel($type) or $page->findRel($type). If the $page has a relation that can be converted to a page instance, that relation will be used. If the $page instance doesn’t have the specified $type, the helper will look for a method in the helper named search$rel$type (e.g. searchRelNext() or searchRevAlternate()). If such a method exists, it will be used for determining the $page‘s relation by traversing the container.

Not all relations can be determined by traversing the container. These are the relations that will be found by searching:

  • searchRelStart(), forward ‘start’ relation: the first page in the container.
  • searchRelNext(), forward ‘next’ relation; finds the next page in the container, i.e. the page after the active page.
  • searchRelPrev(), forward ‘prev’ relation; finds the previous page, i.e. the page before the active page.
  • searchRelChapter(), forward ‘chapter’ relations; finds all pages on level 0 except the ‘start’ relation or the active page if it’s on level 0.
  • searchRelSection(), forward ‘section’ relations; finds all child pages of the active page if the active page is on level 0 (a ‘chapter’).
  • searchRelSubsection(), forward ‘subsection’ relations; finds all child pages of the active page if the active pages is on level 1 (a ‘section’).
  • searchRevSection(), reverse ‘section’ relation; finds the parent of the active page if the active page is on level 1 (a ‘section’).
  • searchRevSubsection(), reverse ‘subsection’ relation; finds the parent of the active page if the active page is on level 2 (a ‘subsection’).

Note

When looking for relations in the page instance ($page->getRel($type) or $page->getRev($type)), the helper accepts the values of type String, Array, Zend\Config, or Zend\Navigation\Page\AbstractPage. If a string is found, it will be converted to a Zend\Navigation\Page\Uri. If an array or a config is found, it will be converted to one or several page instances. If the first key of the array/config is numeric, it will be considered to contain several pages, and each element will be passed to the page factory. If the first key is not numeric, the array/config will be passed to the page factory directly, and a single page will be returned.

The helper also supports magic methods for finding relations. E.g. to find forward alternate relations, call $helper->findRelAlternate($page), and to find reverse section relations, call $helper->findRevSection($page). Those calls correspond to $helper->findRelation($page, ‘rel’, ‘alternate’); and $helper->findRelation($page, ‘rev’, ‘section’); respectively.

To customize which relations should be rendered, the helper uses a render flag. The render flag is an integer value, and will be used in a bitwise and (&) operation against the helper’s render constants to determine if the relation that belongs to the render constant should be rendered.

See the example below for more information.

  • Zend\View\Helper\Navigation\Links::RENDER_ALTERNATE
  • Zend\View\Helper\Navigation\Links::RENDER_STYLESHEET
  • Zend\View\Helper\Navigation\Links::RENDER_START
  • Zend\View\Helper\Navigation\Links::RENDER_NEXT
  • Zend\View\Helper\Navigation\Links::RENDER_PREV
  • Zend\View\Helper\Navigation\Links::RENDER_CONTENTS
  • Zend\View\Helper\Navigation\Links::RENDER_INDEX
  • Zend\View\Helper\Navigation\Links::RENDER_GLOSSARY
  • Zend\View\Helper\Navigation\Links::RENDER_COPYRIGHT
  • Zend\View\Helper\Navigation\Links::RENDER_CHAPTER
  • Zend\View\Helper\Navigation\Links::RENDER_SECTION
  • Zend\View\Helper\Navigation\Links::RENDER_SUBSECTION
  • Zend\View\Helper\Navigation\Links::RENDER_APPENDIX
  • Zend\View\Helper\Navigation\Links::RENDER_HELP
  • Zend\View\Helper\Navigation\Links::RENDER_BOOKMARK
  • Zend\View\Helper\Navigation\Links::RENDER_CUSTOM
  • Zend\View\Helper\Navigation\Links::RENDER_ALL

The constants from RENDER_ALTERNATE to RENDER_BOOKMARK denote standard HTML link types. RENDER_CUSTOM denotes non-standard relations that specified in pages. RENDER_ALL denotes standard and non-standard relations.

Methods in the links helper:

  • {get|set}RenderFlag() gets/sets the render flag. Default is RENDER_ALL. See examples below on how to set the render flag.
  • findAllRelations() finds all relations of all types for a given page.
  • findRelation() finds all relations of a given type from a given page.
  • searchRel{Start|Next|Prev|Chapter|Section|Subsection}() traverses a container to find forward relations to the start page, the next page, the previous page, chapters, sections, and subsections.
  • searchRev{Section|Subsection}() traverses a container to find reverse relations to sections or subsections.
  • renderLink() renders a single link element.

Specify relations in pages

This example shows how to specify relations in pages.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$container = new Zend\Navigation\Navigation(array(
    array(
        'label' => 'Relations using strings',
        'rel'   => array(
            'alternate' => 'http://www.example.org/'
        ),
        'rev'   => array(
            'alternate' => 'http://www.example.net/'
        )
    ),
    array(
        'label' => 'Relations using arrays',
        'rel'   => array(
            'alternate' => array(
                'label' => 'Example.org',
                'uri'   => 'http://www.example.org/'
            )
        )
    ),
    array(
        'label' => 'Relations using configs',
        'rel'   => array(
            'alternate' => new Zend\Config\Config(array(
                'label' => 'Example.org',
                'uri'   => 'http://www.example.org/'
            ))
        )
    ),
    array(
        'label' => 'Relations using pages instance',
        'rel'   => array(
            'alternate' => Zend\Navigation\Page\AbstractPage::factory(array(
                'label' => 'Example.org',
                'uri'   => 'http://www.example.org/'
            ))
        )
    )
));

Default rendering of links

This example shows how to render a menu from a container registered/found in the view helper.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
In a view script or layout:
<?php echo $this->view->navigation()->links(); ?>

Output:
<link rel="alternate" href="/products/server/faq/format/xml">
<link rel="start" href="/" title="Home">
<link rel="next" href="/products/server/editions" title="Editions">
<link rel="prev" href="/products/server" title="Foo Server">
<link rel="chapter" href="/products" title="Products">
<link rel="chapter" href="/company/about" title="Company">
<link rel="chapter" href="/community" title="Community">
<link rel="canonical" href="http://www.example.com/?page=server-faq">
<link rev="subsection" href="/products/server" title="Foo Server">

Specify which relations to render

This example shows how to specify which relations to find and render.

1
2
3
4
5
6
7
8
9
Render only start, next, and prev:
$helper->setRenderFlag(Zend\View\Helper\Navigation\Links::RENDER_START |
                       Zend\View\Helper\Navigation\Links::RENDER_NEXT |
                       Zend\View\Helper\Navigation\Links::RENDER_PREV);

Output:
<link rel="start" href="/" title="Home">
<link rel="next" href="/products/server/editions" title="Editions">
<link rel="prev" href="/products/server" title="Foo Server">
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Render only native link types:
$helper->setRenderFlag(Zend\View\Helper\Navigation\Links::RENDER_ALL ^
                       Zend\View\Helper\Navigation\Links::RENDER_CUSTOM);

Output:
<link rel="alternate" href="/products/server/faq/format/xml">
<link rel="start" href="/" title="Home">
<link rel="next" href="/products/server/editions" title="Editions">
<link rel="prev" href="/products/server" title="Foo Server">
<link rel="chapter" href="/products" title="Products">
<link rel="chapter" href="/company/about" title="Company">
<link rel="chapter" href="/community" title="Community">
<link rev="subsection" href="/products/server" title="Foo Server">
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Render all but chapter:
$helper->setRenderFlag(Zend\View\Helper\Navigation\Links::RENDER_ALL ^
                       Zend\View\Helper\Navigation\Links::RENDER_CHAPTER);

Output:
<link rel="alternate" href="/products/server/faq/format/xml">
<link rel="start" href="/" title="Home">
<link rel="next" href="/products/server/editions" title="Editions">
<link rel="prev" href="/products/server" title="Foo Server">
<link rel="canonical" href="http://www.example.com/?page=server-faq">
<link rev="subsection" href="/products/server" title="Foo Server">
Next Previous

© Copyright 2012, Zend Technologies Ltd..

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: release-2.2.3
Versions
release-2.3.7
release-2.3.6
release-2.3.5
release-2.3.4
release-2.3.3
release-2.3.2
release-2.3.1
release-2.3.0
release-2.2.9
release-2.2.8
release-2.2.7
release-2.2.6
release-2.2.5
release-2.2.4
release-2.2.3
release-2.2.2
release-2.2.10
release-2.2.1
release-2.2.0
release-2.1.6
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.
Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to View Helper - Links on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.