Yii is a high-performance, component-based application development framework written in PHP. It helps ease the complexity of building large-scale applications. It enables maximum reusability in web programming, and can significantly accelerate the development process. It does so by allowing the developer to build on top of already well-written, well-tested, and production-ready code. It prevents you from having to rewrite core functionality that is common across many of today's web-based applications, allowing you to concentrate on the business rules and logic specific to the unique application being built.
This book takes a very pragmatic approach to learning the Yii Framework. Throughout the chapters we introduce the reader to many of the core features of Yii by taking a test-first approach to building a real-world task tracking and issue management application called TrackStar. All of the code is provided. The reader should be able to borrow from all of the examples provided to get up and running quickly, but will also be exposed to deeper discussion and explanation to fully understand what is happening behind the scenes.
Chapter 1—Meet Yii introduces Yii at a high level. We learn the importance and utility of using application development frameworks, and the characteristics of Yii that make it incredibly powerful and useful.
Chapter 2—Getting Started walks through a simple Hello, World! style application using the Yii Framework.
Chapter 3—The TrackStar Application provides an introduction to the task management and issue tracking application, TrackStar, that will be built throughout the remainder of the chapters. It also introduces the Test Driven Development (TDD) approach.
Chapter 4—Iteration 1:Creating The Initial TrackStar Application demonstrates the creation of a new database-driven, Yii web application.
Chapter 5—Iteration 2: Project CRUD introduces the automated code generation features of Yii, as we work to build out the "C"reate, "R"ead, "U"pdate and "D"elete functionality for the project entity in our TrackStar application.
Chapter 6—Iteration 3: Adding Tasks introduces us to relational active record and controller class filters in Yii, as we add in the management issues into TrackStar.
Chapter 7—Iteration 4: User Management and Authentication covers the first part of Yii's user authentication and authorization framework, Authentication.
Chapter 8—Iteration 5: User Access Control covers the second part of the user authentication and authentication framework, Authorization. Both Yii's simple access control and role-based access control are covered.
Chapter 9—Iteration 6: Adding User Comments takes a deeper dive into writing relational Active Record queries in Yii as well as introduce a basic portlet architecture for reusing content across multiple pages.
Chapter 10—Iteration 7: Adding an RSS Web Feed demonstrates how easy it is to integrate other third-party frameworks into a Yii application by integrating the Zend Framework's Web Feed library to create simple RSS feed within our application.
Chapter 11—Iteration 8: Making It Pretty: Design, Layout, Themes and Iternationalization (i18n) delves deeper into the presentation tier of Yii, introducing layout views, themes as well as internationalization and localization in Yii.
Chapter 12—Iteration 9: Modules – Adding Administration introduces the concept of a module in Yii by using one to add administrative functionality to the application.
Chapter 13—Iteration 10: Production Readiness covers error handling, logging, caching and, security as we prepare our TrackStar application for production.
To follow along in building the TrackStar application, you will need PHP 5, a web server capable of servicing PHP 5 pages, and a database server. The code has been tested using the Apache 2 web server and a MySQL 5 database. It is certainly possible to use a different PHP5-compatible web server and /or different database server product. While we have attempted to make the examples work independent of the specific web server or database server, we cannot guarantee 100% accuracy if you are using something different. Slight adjustments may be required.
If you are a PHP programmer with knowledge of object-oriented programming and want to rapidly develop modern, sophisticated web applications, then this book is for you. No prior knowledge of Yii is required to follow this book
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 are shown as follows: "You can type in help to see a list of commands available to you within his shell."
A block of code is set as follows:
<h1>Hello, World!</h1> <h3> echo $time; </h3> <p> echo CHtml::link("Goodbye",array('message/goodbye')); </p>
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
<h1>Hello, World!</h1> <h3> echo $time; </h3> <p> echo CHtml::link("Goodbye",array('message/goodbye'));</p>
Any command-line input or output is written as follows:
%cd /WebRoot/demo/protected/tests %phpunit unit/MessageTest.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: "Clicking on the About link provides a simple example of a static page."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
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 email to firstname.lastname@example.org, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email email@example.com.
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.
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 for the book Visit http://www.packtpub.com/files/code/9584_Code.zip to directly download the example code. The downloadable files contain instructions on how to use them.
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 to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub. com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
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 web site name immediately so that we can pursue a remedy.
Please contact us at firstname.lastname@example.org with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at email@example.com if you are having a problem with any aspect of the book, and we will do our best to address it.