Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

The Yii framework is a high-performance, fast, open source, and a rapid development PHP framework that can be used to develop modern web applications. It provides the toolkit for developing both personal projects and enterprise applications.

This book is a step-by-step guide to develop eight reusable real-world applications using the Yii framework. Yii Project Blueprints will guide you through several projects, from project conception to planning your project and finally implementing it. You will explore the key features of the Yii framework and learn how to use it efficiently and effectively to build solid core applications that you'll be able to reuse in real-world projects. You'll also learn how to integrate Yii with third-party libraries and services, create your own reusable code bases, and discover many more Yii features that will expand your knowledge and expertise of Yii.

What this book covers

Chapter 1, A Task-management Application, covers developing a simple task-management application from the ground up using SQLite and basic database migrations. This chapter will cover all the moving parts of Yii and prepare you for working with more complex applications.

Chapter 2, Discovering What's Nearby, covers how to integrate the Yii framework with the Google Maps API to display information about what is near a given user. You'll also learn how to create command-line tools to handle importing and processing data.

Chapter 3, Scheduled Reminders, focuses on developing a multiuser web-based scheduling and reminders application that can notify users via e-mail when a scheduled event is about to occur.

Chapter 4, Developing an Issue-tracking Application, covers how to create a multiuser issue-tracking and management system, complete with an e-mail notification system using MySQL as a database backend. This chapter will also cover handling input from e-mail submissions to trigger actions within the application.

Chapter 5, Creating a Microblogging Platform, covers how to create your own microblogging platform similar to Twitter, complete with a robust user authentication and registration system. You'll also learn how to integrate your application with third-party social networks using HybridAuth, as well as how to streamline your headless development time with Composer.

Chapter 6, Building a Content Management System, covers how to create a feature-complete content management system and blogging platform that expands using the knowledge built upon in the previous chapters. This chapter will also demonstrate how to integrate with even more third-party open source libraries.

Chapter 7, Creating a Management Module for the CMS, focuses on the development of a management module for the content management system built in the previous chapter. In this chapter, you'll learn how to migrate data from controllers to a Yii module that can be reused and managed independently of the content management system.

Chapter 8, Building an API for the CMS, covers how to create a JSON REST API module for the content management system that can be used for both client-side web applications and native development. This chapter will cover the basics of creating a secure and authenticated JSON REST API, and will demonstrate how to adapt controller actions for JSON responses rather than web view responses.

What you need for this book

To ensure that you can run the examples provided on any operating system and to ensure the accuracy of command-line entries, this book will use VirtualBox and Vagrant to establish a common development platform. Provided with this book are instructions on how to set up this cross-platform development environment. For this book, you'll need the following:

  • VirtualBox 4.3.x

  • Vagrant 1.3.x

  • Ubuntu Server 14.04 LTS

  • MySQL 5.6.x

  • PHP 5.5.x

  • Yii framework 1.1.x

  • Composer

Who this book is for

This book is for you if you are a PHP developer with a good knowledge of PHP5 and some experience with the Yii framework and want to jump-start your knowledge of Yii and start building reusable real-world applications and tools.

Conventions

In this book, you will 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, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We'll also need to modify our UserIdentity class to allow for socially authenticated users to sign in."

A block of code is set as follows:

<?php
// change the following paths if necessary
$config=dirname(__FILE__).'/config/main.php';
$config = require($config);
require_once('/opt/frameworks/php/yii/framework/yiic.php');

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

<div class="form-group">
<?php $selected = array('options' => array(isset($_
GET['id']) ? $_GET['id'] : NULL => array('selected' => true))); ?>
<?php echo CHtml::dropDownList('id', array(), CH
tml::listData(Location::model()->findAll(),'id','name'), 
CMap::mergeArray($selected, array('empty' => 'Select a Location'))); 
?>
</div>
<button type="submit" class="pull-right btn btnprimary">Search</button>
</form>

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

$ php protected/yiic.php migrate up

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: "Click on the link titled Model Generator, and then fill in the form on the page that appears."

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 via 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.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/7734OS_ColoredImages.pdf.

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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

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.