Learn the Yii application development framework by taking a step-by-step approach to building a Web-based project task tracking system from conception through production deployment.
This book is a step by step tutorial in developing a real-world application using the incremental and iterative approach to software development. You learn about agile software development by leaning on the agile nature of the Yii application development framework. You touch on each aspect of the software development lifecycle by building a project task management application from concept through production deployment.
After a brief, general introduction to the Yii framework and outlining the software development approach taken throughout the book, the chapters break down in the same way as software development iterations do in real-world projects. After the 1st iteration, you will have a working and tested application with a valid, tested connection to a database.
In the 2nd and 3rd iterations, we flesh out our main database entities and domain object model and become familiar with Yii's object-relational-mapping (ORM) layer, Active Record. We also learn how to lean on Yii's auto-generation tools to automatically build our create/read/update/delete (CRUD) functionality against our newly created model. These iterations also focus on how Yii's form validation and submission model works. By the end of the third iteration you will have a working application that allows you to mange projects and issues (tasks) within those projects.
The 4th and 5th iterations are dedicated to user management. We learn about the built-in authentication model within Yii to assist in application login and logout functionality. We then dive into the authorization model, first taking advantage of a Yii's simple access control model, then implementing the more sophisticated role-based access control (RBAC) framework that Yii provides.
By the end of the 5th iteration, all of the basics of a task management application are in place. The next several iterations are focused on the nice-to-haves. We add user comment functionality, introducing a reusable content portlet architecture approach in the process. We add in an RSS Web feed and demonstrate how easy it is to integrate other third-party tools within a Yii application. We take advantage of Yii's theming structure to help streamline and design the application, and then introduce Yii's internationalization (I18N) features so the application can be adapted to various languages and regions without engineering changes.
Finally, we turn our focus to production deployment. We introduce ways to optimize performance and security to prepare the application for a real-world production environment.
What this book covers
Chapter 1, Meet Yii, provides you with a brief history of Yii, an introduction to the Model View Controller (MVC) application architecture, and you are introduced to the typical request life cycle as it makes its way from the end user through the application, and finally as a response back to the end user.
Chapter 2, Getting Started, is dedicated to downloading and installing the framework, creating a new Yii application shell, and introducing Gii, Yii's powerful and flexible code generation tool.
Chapter 3, The TrackStar Application, is where the TrackStar application is introduced. This is an online, project-management and issue-tracking application that you will be building throughout the remaining chapters. Here you learn how to connect a Yii application to an underlying database. You also learn how to run the interactive shell from the command line. The last part of this chapter is focused on providing an overview of unit and functional testing within a Yii application, and provides a concrete example of writing a unit test in Yii.
Chapter 4, Project CRUD, helps you to start interacting with the database, to begin adding features to the database-driven Yii application TrackStar. You learn how to use Yii Migrations for database change management, and we use the Gii tool to create model classes and also to build out create, read, update, and delete (CRUD) functionality using the model class. The reader is also introduced to configuring and performing form field validation in this chapter.
Chapter 5, Managing Issues, explains how additional related database tables are added to the TrackStar application, and how the reader is introduced to the relational Active Record in Yii. This chapter also covers using controller filters to tap into the application life cycle in order to provide pre-action and post-action processing. The official Yii extension library Zii is introduced, and we use Zii widgets to enhance the
Chapter 6, User Management and Authentication, explains how to authenticate users in a Yii. While adding the ability to manage users in the TrackStar application, the reader learns to take advantage of Behaviors in Yii, which provide an extremely flexible approach to sharing common code and functionality across your Yii components. This chapter also covers the Yii authentication model in detail.
Chapter 7, User Access Control, is dedicated to Yii's authorization model. First we cover the simple access control features, which allow you to easily configure access rules for the controller actions that are based on several parameters. Then we look at how role-based access control (RBAC) is implemented in Yii, which allows a much more robust authorization model for complete access control based on hierarchical model of roles, operations, and tasks. Implementing role-based access control into the TrackStar application also introduced the reader to using the console command in Yii.
Chapter 8, Adding User Comments, helps demonstrate how to implement the feature for allowing users to leave comments on projects and issues in the TrackStar application; we introduce how to configure and use a statistical query relation, how to create highly reusable user interface components called Widgets, and how to define and use named scopes in Yii.
Chapter 9, Adding an RSS Web Feed, demonstrates how easy it is to use other third-party frameworks and libraries in Yii applications, and shows you how to use the URL management features of Yii to customize your applications' URL format and structure.
Chapter 10, Making It Look Good, helps you learn more about the views in Yii, and how to use layouts to manage markup and content shared across your application pages. Theming is also introduced, as we show how easy it is to give a Yii application a completely new look without having to alter any of the underlying engineering. We then take a look at internationalization (i18n) and localization (l10n) in Yii as language translation is added to our TrackStar application.
Chapter 11, Using Yii Modules, explains how to add administrative features to the TrackStar site by using a Yii module. Modules provide a very flexible approach to developing and managing the larger, self-contained sections of your application.
Chapter 12, Production Readiness, helps us prepare our TrackStar application for production. You learn about Yii's logging framework, caching techniques, and error-handling methods to help get your Yii applications production-ready.Author: Jeffrey Winesett