Book Image

Zend Framework 2.0 by Example: Beginner's Guide

By : Krishna Shasankar V
Book Image

Zend Framework 2.0 by Example: Beginner's Guide

By: Krishna Shasankar V

Overview of this book

<p>ZF2 is the latest update to the well-known Zend Framework. This version has considerably eased the process of building complex web applications with minimal development effort using plug and play components. ZF2 also provides a highly robust and scalable framework for developing web applications.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" will guide you through the process of developing powerful web applications using ZF2. It covers all aspects of Zend Framework application development right from installation and configuration; the tasks are designed in a way that readers can easily understand and use them to build their own applications with ease.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" begins with the basic installation and configuration of the Zend Framework. As you progress through the exercises, you will become thoroughly acquainted with ZF2. With this book, you will learn about the basic concepts of building solid MVC web applications using Zend Framework 2.0. The detailed step-by-step instructions will enable you to build functionality such as a group chat, a file &amp; media sharing service, search, and a simple store to name a few. You will also use a wide range of external modules to implement features that are not natively available. By the end of the book, you will be well versed in building complex, functionality-rich web applications using Zend Framework 2.0.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" provides everything that you need for building functionality-rich web applications with simple real world examples and tasks.</p>
Table of Contents (18 chapters)
Zend Framework 2.0 by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Zend Framework 2 is the latest update to the well-known Zend Framework. This version has considerably eased the process of building complex web applications with minimal development effort using plug and play components. Zend Framework 2 also provides a highly robust and scalable framework for developing web applications.

This book will guide you through the process of developing powerful web applications using ZF2. It covers all aspects of Zend Framework application development right from installation and configuration; the tasks are designed in a way that readers can easily understand and use them to build their own applications with ease.

This book begins with basic installation and configuration of the Zend Framework. As you progress through the exercises, you will become thoroughly acquainted with ZF2. With this book, you will learn about the basic concepts of building solid MVC web applications using Zend Framework 2. The detailed step-by-step instructions will enable you to build functionality such as a group chat, a file and media sharing service, search, and a simple store, to name a few. You will also use a wide range of external modules to implement features that are not natively available.

By the end of the book, you will be well versed in building complex and functionality-rich web applications using Zend Framework 2.

What this book covers

Chapter 1, Getting Started with Zend Framework 2.0, introduces you to the configuration of the development environment. In this chapter, we will set up a PHP application server, install MySQL, and create a development database which will be used in subsequent chapters for our Zend Framework learning exercises.

Chapter 2, Building Your First Zend Framework Application, explains the creation of the Zend Framework 2 project; we will be reviewing some of the key aspects of building a ZF2 MVC application by creating modules, controllers, and views. We will be creating our own custom module in Zend Framework which will be enhanced further in subsequent chapters of this book.

Chapter 3, Creating a Communication Application, introduces you to Zend\Form. In this chapter we will create our first registration form, and set up login and authentication for registered users using Zend Framework components.

Chapter 4, Data Management and Document Sharing, covers some of Zend Framework's data and file management concepts. In this chapter, we will learn various aspects of Zend Framework including ServiceManager, the TableGateway pattern, handling uploads, and file sharing.

Chapter 5, Chat and E-mail, covers the use of JavaScript in your application. This chapter uses a simple group chat implementation as an example for explaining the usage of JavaScript in your applications; you will also be introduced to sending e-mails using Zend\Mail and the ZF2 event manager.

Chapter 6, Media Sharing, explains the management and sharing of images and videos using Zend Framework. In this chapter, we will use of various external Zend Framework 2 modules to work with images and videos.

Chapter 7, Search using Lucene, introduces you to the Lucene search implementation using Zend Framework. This chapter begins by explaining the users about the installation of ZendSearch\Lucene module, we then cover the details of implementing search for database records and also document files.

Chapter 8, Creating a Simple Store, introduces you to e-commerce. In this chapter, we will be building a simple online store to demonstrate the process involved in development of a shopping cart. We will be using PayPal Express Checkout as our payment processer in this chapter.

Chapter 9, HTML5 Support, introduces you to HTML5 support in Zend Framework 2. When compared to the previous version, ZF2 offers exhaustive support for various HTML5 features; this chapter covers two major aspects of ZF2's HTML5 support—new input types and multiple file uploads.

Chapter 10, Building Mobile Applications, introduces you to the development of native mobile applications with the help of Zend Framework 2 and Zend Studio 10. In this chapter, we will learn the fundamentals of building cloud-connected mobile applications using Zend Framework; we will also learn about the setup of Zend PHP developer cloud environment.

What you need for this book

You will need a system that is capable of running Zend Server CE along with MySQL. The prerequisite software that is required for working with tasks to be performance in the book is covered in Chapter 1, Getting Started with Zend Framework 2.0.

Who this book is for

If you are a PHP developer who is new to Zend Framework, but you want to get hands-on with the product quickly, this book is for you. Basic knowledge of object-oriented programming with PHP is expected.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short multiple-choice questions intended to help you test your own understanding.

Have a go hero – heading

These practical challenges give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "The TableGateway class extends AbstractTableGateway which implements TableGatewayInterface."

A block of code is set as follows:

    // Add Document to index
    $indexDoc = new Lucene\Document();
    $indexDoc->addField($label);
    $indexDoc->addField($owner);
    $indexDoc->addField($fileUploadId);
    $index->addDocument($indexDoc);
  }
  // Commit Index
  $index->commit();

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    // Add Document to index
    $indexDoc = new Lucene\Document();
    $indexDoc->addField($label);
    $indexDoc->addField($owner);
    $indexDoc->addField($fileUploadId);
    $index->addDocument($indexDoc);
  }
  // Commit Index
  $index->commit();

Any command-line input or output is written as follows:

$ sudo apt-get install php5-cli  
$ sudo apt-get install git
$ curl -s https://getcomposer.org/installer | php

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "On the Select Destination Location screen, click on Next to accept the default destination."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this |book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.