Book Image

Zend Framework 2 Application Development

By : Christopher Valles
Book Image

Zend Framework 2 Application Development

By: Christopher Valles

Overview of this book

<p>Zend Framework 2 has a flexible architecture that lets us build modern web applications and web services easily. It also provides an easy-to-use, high quality component library that is designed to be used the way you want. It's easy to get started and produce a powerful and professional looking website with Zend Framework 2 Application Development. Exploring real life applications, we will explore the Zend Framework 2 components, as well as throwing some light on best practices and design concerns faced when building complex MVC applications.Zend Framework 2 Application Development is a hands-on guide to building your application. We will explore the components of this new version of the framework and discover how to use each component, the options available, and how to get the most from each component. Whilst learning everything you need to know, we’ll even create our own social network. We will also learn to engineer an application using an API-centric approach, broadly used today to build applications that work seamlessly on desktops, mobiles and tablets. We will learn how to filter and validate data, interact with databases to retrieve and store data, handle and manipulate file uploads, interact with other websites, deal with spam, and also protect your APIs using OAuth authentication whilst allowing people from all over the world to interact with your application. Zend Framework 2 Application Development is your guide to everything you need to know to build applications of any size for big and small companies alike, whilst using the right components for the job.</p>
Table of Contents (21 chapters)
Zend Framework 2 Application Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
4
The First Request/Response – Building the User Wall
5
Handling Text Content – Posting Text
6
Working with Images – Publishing Pictures
8
Dealing with Spam – Akismet to the Rescue
Index

What are we going to build?


The objective of this book is to show you as many components of Zend Framework 2 (ZF2) as possible. In order to achieve this, we will build a basic social network that will allow the user to post text, pictures, links, comments, and so on. This will cover all the basics of the framework and also demonstrate the usage of the majority of the components in common real-life scenarios.

Let's see all the functionalities and sections this social network will offer to the users.

Building a user profile

The user wall will be the main section where users can share content. Users will be able to post text, images, and URLs.

By building this section, we will experiment with the first request and building blocks of ZF2, and in the meantime we are going to see the technical approach chosen for the project in action.

Posting text

Users will be able to post text on their wall and also on their friends' walls using a simple form. To accomplish this, we will have a look at how forms work and how to use filters and validators to ensure that the data is secure and correct.

Uploading pictures

Pictures are one of the forms of media shared extensively by users of social networks. In our case, we will give users the opportunity to do this. On implementing this functionality, we will see how the new Zend\Form element handles the upload of files, and how to process them.

Sharing links

URLs are the last thing users will be able to share on the profile. A description will appear automatically with the link. This functionality will allow us to discover how to crawl contents from remote websites, filter them, and store them.

Posting comments

People also enjoy commenting on the content of others people and we will give the user a way to do this on our social network. An interesting part of ZF2 will be used in this section to fight spam. We will see how to use third-party services using Akismet.

Building news reader

Building news reader is a big section on the project. From here, the user will be able to add, remove, read, and organize RSS feeds. We will use Zend\Feed to do basic RSS actions and provide the frontend with data.

Registering and logging in

A basic action that users should be able to do is register and login to the social network. We will provide them with the forms to do this. We are going to integrate the session handling through Zend\Session and the login functionality using Zend\Authentication on this project.

E-mails

Another functionality that social networks provide is keeping the user updated about what is happening while he/she is away. We will implement a notification system and also a way to recover the password if you lose it. On building this section of the project, we will see the Zend\Mail component in action and how to use it to send e-mails.

Public APIs

The last functionality we will provide in our project is the ability to integrate our data and functionalities in other projects. In order to accomplish this, we will expose our API to the outside world using OAuth 2.0. Here, we will learn how to put an OAuth 2.0 authentication mechanism with ZF2 in place.