Yii Application Development Cookbook - Second Edition

This book is the perfect way to add the capabilities of Yii to your PHP5 development skills. Dealing with practical solutions through real-life recipes and screenshots, it enables you to write applications more efficiently.
Preview in Mapt
Code Files

Yii Application Development Cookbook - Second Edition

Alexander Makarov

This book is the perfect way to add the capabilities of Yii to your PHP5 development skills. Dealing with practical solutions through real-life recipes and screenshots, it enables you to write applications more efficiently.
Mapt Subscription
FREE
$29.99/m after trial
eBook
$18.90
RRP $26.99
Save 29%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$18.90
$44.99
$29.99p/m after trial
RRP $26.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Yii Application Development Cookbook - Second Edition Book Cover
Yii Application Development Cookbook - Second Edition
$ 26.99
$ 18.90
Yii2 Application Development Cookbook - Third Edition Book Cover
Yii2 Application Development Cookbook - Third Edition
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $31.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781782163107
Paperback408 pages

Book Description

The Yii framework is a rapidly growing PHP5 MVC framework often referred to as Rails for PHP. It has already become a solid base for many exciting web applications such as Stay.com and can be a good base for your developments, too. This book will help you to learn Yii quickly and in more depth for use in for your developments.

"Yii Application Development Cookbook" will show you how to use Yii efficiently. You will learn about taking shortcuts using core features, creating your own reusable code base, using test driven development, and many more topics that will give you a lot of experience in a moderate amount of time.

The second edition fixes all errata found in the first edition and also features new recipes on the client side, HTTP caching, and using Composer with Yii.

The chapters of the book are generally independent and since this book’s goal is to enhance a practical approach to Yii development, you can start reading from the chapter you need most, be it Ajax and jQuery, Database, Active Record, and Model Tricks, or Extending Yii.

"Yii Application Development Cookbook" will help you to learn more about the Yii framework and application development practices in general, showing shortcuts and dangerous things you shouldn’t do.

With all the recipes grouped in 13 chapters, you will write your applications more efficiently using shortcuts and using Yii core functionality in a good way. The most interesting topics are; Yii application deployment, a guide to writing your own extensions, advanced error handling, debugging and logging, application security, performance tuning, and much more.

"Yii Application Development Cookbook" will help you to learn more about the Yii framework and application development practices in general. You will write your applications more efficiently using shortcuts and using Yii core functionality in a good way.

Table of Contents

Chapter 1: Under the Hood
Introduction
Using getters and setters
Using Yii events
Using import and autoloading
Using exceptions
Configuring components
Configuring widget defaults
Using Yii core collections
Working with requests
Chapter 2: Router, Controller, and Views
Introduction
Configuring URL rules
Generating URLs by path
Using regular expressions in URL rules
Creating URL rules for static pages
Providing your own URL rules at runtime
Using a base controller
Using external actions
Displaying static pages with CViewAction
Using flash messages
Using the controller context in a view
Reusing views with partials
Using clips
Using decorators
Defining multiple layouts
Paginating and sorting data
Chapter 3: AJAX and jQuery
Introduction
Loading a block through AJAX
Managing assets
Including resources in the page
Working with JSON
Passing configuration from PHP to JavaScript
Handling variable number of inputs
Rendering content at the client side
Chapter 4: Working with Forms
Introduction
Writing your own validators
Uploading files
Adding CAPTCHA
Customizing CAPTCHA
Creating a custom input widget with CInputWidget
Chapter 5: Testing Your Application
Introduction
Setting up the testing environment
Writing and running unit tests
Using fixtures
Testing the application with functional tests
Generating code coverage reports
Chapter 6: Database, Active Record, and Model Tricks
Introduction
Getting data from a database
Defining and using multiple DB connections
Using scopes to get models for different languages
Processing model fields with AR event-like methods
Applying markdown and HTML
Highlighting code with Yii
Automating timestamps
Setting up an author automatically
Implementing single table inheritance
Using CDbCriteria
Chapter 7: Using Zii Components
Introduction
Using data providers
Using grids
Using lists
Creating custom grid columns
Chapter 8: Extending Yii
Introduction
Creating model behaviors
Creating components
Creating reusable controller actions
Creating reusable controllers
Creating a widget
Creating CLI commands
Creating filters
Creating modules
Creating a custom view renderer
Making extensions distribution-ready
Chapter 9: Error Handling, Debugging, and Logging
Introduction
Using different log routes
Analyzing the Yii error stack trace
Logging and using the context information
Implementing your own smart 404 handler
Chapter 10: Security
Introduction
Using controller filters
Using CHtml and CHtmlPurifier to prevent XSS
Preventing SQL injections
Preventing CSRF
Using RBAC
Chapter 11: Performance Tuning
Introduction
Following best practices
Speeding up session handling
Using cache dependencies and chains
Profiling an application with Yii
Leveraging HTTP caching
Chapter 12: Using External Code
Introduction
Using Zend Framework from Yii
Customizing the Yii autoloader
Using Kohana inside Yii
Using PEAR inside Yii
Using Composer with Yii
Chapter 13: Deployment
Introduction
Changing the Yii directory layout
Moving an application out of webroot
Sharing the framework directory
Moving configuration parts into separate files
Using multiple configurations to simplify the deployment
Implementing and executing cron jobs
Maintenance mode

What You Will Learn

  • Make use of internal Yii features, such as events and collections
  • Get the maximum out of your controller and views and make them reusable
  • Work with jQuery, JavaScript, and AJAX the Yii way
  • Make your application error-free using TDD approach
  • Use Active Record efficiently
  • Utilize Zii components such as grids and data providers
  • Implement, package, and share your code as a reusable extension
  • Tune your application for better performance and also learn general performance principles and Yii-related settings

Authors

Table of Contents

Chapter 1: Under the Hood
Introduction
Using getters and setters
Using Yii events
Using import and autoloading
Using exceptions
Configuring components
Configuring widget defaults
Using Yii core collections
Working with requests
Chapter 2: Router, Controller, and Views
Introduction
Configuring URL rules
Generating URLs by path
Using regular expressions in URL rules
Creating URL rules for static pages
Providing your own URL rules at runtime
Using a base controller
Using external actions
Displaying static pages with CViewAction
Using flash messages
Using the controller context in a view
Reusing views with partials
Using clips
Using decorators
Defining multiple layouts
Paginating and sorting data
Chapter 3: AJAX and jQuery
Introduction
Loading a block through AJAX
Managing assets
Including resources in the page
Working with JSON
Passing configuration from PHP to JavaScript
Handling variable number of inputs
Rendering content at the client side
Chapter 4: Working with Forms
Introduction
Writing your own validators
Uploading files
Adding CAPTCHA
Customizing CAPTCHA
Creating a custom input widget with CInputWidget
Chapter 5: Testing Your Application
Introduction
Setting up the testing environment
Writing and running unit tests
Using fixtures
Testing the application with functional tests
Generating code coverage reports
Chapter 6: Database, Active Record, and Model Tricks
Introduction
Getting data from a database
Defining and using multiple DB connections
Using scopes to get models for different languages
Processing model fields with AR event-like methods
Applying markdown and HTML
Highlighting code with Yii
Automating timestamps
Setting up an author automatically
Implementing single table inheritance
Using CDbCriteria
Chapter 7: Using Zii Components
Introduction
Using data providers
Using grids
Using lists
Creating custom grid columns
Chapter 8: Extending Yii
Introduction
Creating model behaviors
Creating components
Creating reusable controller actions
Creating reusable controllers
Creating a widget
Creating CLI commands
Creating filters
Creating modules
Creating a custom view renderer
Making extensions distribution-ready
Chapter 9: Error Handling, Debugging, and Logging
Introduction
Using different log routes
Analyzing the Yii error stack trace
Logging and using the context information
Implementing your own smart 404 handler
Chapter 10: Security
Introduction
Using controller filters
Using CHtml and CHtmlPurifier to prevent XSS
Preventing SQL injections
Preventing CSRF
Using RBAC
Chapter 11: Performance Tuning
Introduction
Following best practices
Speeding up session handling
Using cache dependencies and chains
Profiling an application with Yii
Leveraging HTTP caching
Chapter 12: Using External Code
Introduction
Using Zend Framework from Yii
Customizing the Yii autoloader
Using Kohana inside Yii
Using PEAR inside Yii
Using Composer with Yii
Chapter 13: Deployment
Introduction
Changing the Yii directory layout
Moving an application out of webroot
Sharing the framework directory
Moving configuration parts into separate files
Using multiple configurations to simplify the deployment
Implementing and executing cron jobs
Maintenance mode

Book Details

ISBN 139781782163107
Paperback408 pages
Read More

Read More Reviews

Recommended for You

Web Application Development with Yii and PHP Book Cover
Web Application Development with Yii and PHP
$ 26.99
$ 18.90
Web Application Development with Yii 2 and PHP Book Cover
Web Application Development with Yii 2 and PHP
$ 21.99
$ 15.40
Yii Rapid Application Development HOTSHOT Book Cover
Yii Rapid Application Development HOTSHOT
$ 29.99
$ 21.00
Building Websites with PHP-Nuke Book Cover
Building Websites with PHP-Nuke
$ 20.99
$ 14.70
Responsive Web Design with HTML5 and CSS3 Book Cover
Responsive Web Design with HTML5 and CSS3
$ 23.99
$ 4.80
Mastering Web Application Development with AngularJS Book Cover
Mastering Web Application Development with AngularJS
$ 26.99
$ 5.40