Preface

This book is a guide that describes the process of incremental, test-first development of a web application using Yii framework Version 2.

The Yii framework, hosted at http://www.yiiframework.com/, is a PHP-based application framework built around the Model-View-Controller composite pattern. It is suitable for building both web and console applications, but its feature set makes it most useful for web applications. It has several code generation facilities, including the full create-read-update-delete (CRUD) interface maker. It relies heavily on the conventions expressed in its default configuration settings.

Overall, if all you need is a fancy interface for the underlying database, there is probably nothing better for you than the Yii framework. Given the extensive configuration options, any kind of application can be made from Yii.

Version 2 of the Yii framework is built utilizing the latest improvements in the PHP infrastructure collected over the years. It uses the Composer utility (see https://getcomposer.org/) as a primary distribution method, PSR levels 1, 2, and 4 from the PHP Framework Interop Group guidelines (see http://www.php-fig.org/), and PHP 5.4+ features, such as short array syntax and closures.

At the time of writing, Yii 2 is at the stage of late beta. Some changes are expected, but there should not be backward-compatibility-breaking changes anymore. Thus, the content of this book can be reasonably trusted even if the framework can attain some additional features after this book is published.

What this book covers

Chapter 1, Getting Started, covers the simplest possible methods to raise a working web application completely from scratch using the Yii framework.

Chapter 2, Making a Custom Application with Yii 2, shows how the process of implementation of a web application with a single, working, tested feature can be done from scratch using the Yii framework.

Chapter 3, Automatically Generating the CRUD Code, shows how we can implement a working, tested feature in an existing web application using only the code generation facilities and not a line of custom code written.

Chapter 4, The Renderer, describes the details of how the framework renders its output and presents some tricks to introduce customizations to the rendering process.

Chapter 5, User Authentication, discusses the tools to provide authentication to application visitors.

Chapter 6, User Authorization and Access Control, explains the ways to control access for application visitors, and, especially, about the role-based access control system.

Chapter 7, Modules, returns from the exact features of the framework to its fundamentals. Here we will clearly understand the internal structure and logic of the Yii-based application and how it influences the overall design.

Chapter 8, Overall Behavior, is about the infrastructure of the Yii-based application. We will learn about several features that affect the application as a whole.

Chapter 9, Making an Extension, tells us how to make the extension to the Yii 2 framework and prepare it so that it is installable in the same way as the extensions built-in to the basic distribution of the framework itself.

Chapter 10, Events and Behaviors, investigates the intricacies of the system inside the Yii 2 framework allowing us to attach custom behavior to many of the usual activities of the application, such as fetching a record from the database or rendering a view file.

Chapter 11, The Grid, has two purposes. First, it explains the powerful and complex GridView widget, which allows you to make complicated, table-based interfaces relatively easily. Second, it presents a different approach in developing applications using the Yii 2 framework, the one that is customary in its community, so you can see both the advantages and the disadvantages of both approaches.

Chapter 12, Route Management, explains the top level of the framework, that is, how it responds to HTTP requests from actual visitors.

Chapter 13, Collaborative Work, concludes the book by presenting the methods that help to manage the code base of a Yii-based application when there are several developers working on it.

Appendix A, Deployment Setup with Vagrant, shows a simple way to construct a virtual machine for your local development, which you can use for building the examples from this book.

Appendix B, The Active Form Primer, contains an extension to Chapter 11, The Grid, in which we use another powerful user interface widget of Yii 2, the ActiveForm. It was excluded from the chapter text because it's not directly related to the GridView widget, but we could not gloss over it completely. Without the ActiveForm, the feature we were building in Chapter 11, The Grid, is not complete.

Through the course of the book, starting from Chapter 2, Making a Custom Application with Yii 2, we'll be working with a single code base. Later chapters will build over the work previously done, so the book is expected to be read sequentially, without skipping or changing order.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.131.47