Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Yii Application Development Cookbook - Second Edition
Yii Application Development Cookbook - Second Edition

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. , Second Edition

eBook
€8.98 €28.99
Paperback
€37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Yii Application Development Cookbook - Second Edition

Chapter 2. Router, Controller, and Views

In this chapter, we will cover:

  • 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

Introduction


This chapter will help you to learn some handy things about the Yii URL router, controllers, and views. You will be able to make your controllers and views more flexible.

Configuring URL rules


The Yii URL router is quite powerful and does two main tasks: it resolves URLs into internal routes and creates URLs from these routes. Router rules description is scattered over the official Yii guide and API docs. Let's try to understand how to configure application rules by example.

Getting ready

  1. Create a fresh Yii application using yiic webapp as described in the official guide (http://www.yiiframework.com/doc/guide/) and find your protected/config/main.php file. It should contain the following:

    // application components
    'components'=>array(
       …
      // uncomment the following to enable URLs in path-format
    'urlManager'=>array(
          'urlFormat'=>'path',
          'rules'=>array(
             '<controller:\w+>/<id:\d+>'=>'<controller>/view',
             '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
             '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
     ...

Generating URLs by path


Yii allows you to not only route your URLs to different controller actions but also to generate a URL by specifying a proper internal route and its parameters. This is really useful because you can focus on internal routes while developing your application, and only worry about real URLs before going live.

Tip

Never specify URLs directly and make sure you use the Yii URL toolset. It will allow you to change URLs without rewriting a lot of application code.

Getting ready

  1. Create a fresh Yii application using yiic webapp as described in the official guide and find your protected/config/main.php file. Replace the rules array as follows:

    // application components
    'components'=>array(
       …
       // uncomment the following to enable URLs in path-format
       /*
       'urlManager'=>array(
          'urlFormat'=>'path',
          'rules'=>array(
          '<alias:about>' => 'website/page',
          'page/about/<alias:authors>' => 'website/page',
          'page/<alias>...

Using regular expressions in URL rules


One of the hidden features of the Yii URL router is that you can use regular expressions that are pretty powerful when it comes to strings handling.

Getting ready

  1. Create a fresh Yii application using yiic webapp as described in the official guide and find your protected/config/main.php file. It should contain the following:

    // application components
    'components'=>array(
       …
       // uncomment the following to enable URLs in path-format
       /*
       'urlManager'=>array(
          'urlFormat'=>'path',
          'rules'=>array(
             '<controller:\w+>/<id:\d+>'=>'<controller>/view',
             '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
              '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
          ),
       ),
  2. Delete everything from rules as we are going to start from scratch.

  3. In your protected/controllers directory, create PostController.php with...

Creating URL rules for static pages


A website typically contains some static pages. Usually, they include /about, /contact, /tos, and so on, and it is common to handle these pages in a single controller action. Let's find a way to create URL rules for these types of pages.

Getting ready

  1. Create a fresh Yii application using yiic webapp as described in the official guide and find your protected/config/main.php file. It should contain the following:

    // application components
    'components'=>array(
       …
       // uncomment the following to enable URLs in path-format
       /*
       'urlManager'=>array(
          'urlFormat'=>'path',
          'rules'=>array(
             '<controller:\w+>/<id:\d+>'=>'<controller>/view',
             '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
             '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
          ),
       ),
  2. Delete everything from rules as we are going to start...

Providing your own URL rules at runtime


When you are developing an application with a pluggable module architecture, you most likely need to somehow inject your module-specific rules into an existing application.

Getting ready

  1. Set up a new application using yiic webapp.

  2. Add .htaccess, shown in the official URL management guide to your webroot folder.

  3. Uncomment the urlManager section in protected/config/main.php and add 'showScriptName' => false.

  4. Generate the page module using Gii. You need to uncomment the gii section under modules and set a password. Then, open http://localhost/gii in your browser.

  5. Don't forget to add your new module to the modules list in your application configuration.

The Yii code generator is shown in the following screenshot:

How to do it...

  1. Create ModuleUrlManager.php in your protected/components directory with the following code inside it:

    <?php
    class ModuleUrlManager
    {
      static function collectRules()
      {
        if(!empty(Yii::app()->modules))
        {
           foreach(Yii...

Using a base controller


In many frameworks, the concept of a base controller that is being extended by other ones is described right in the guide. In Yii, it is not in the guide as you can achieve flexibility in many other ways. Still, using a base controller is possible and can be useful.

Getting ready

We are going to set up a new application using yiic webapp.

Let's say we want to add some controllers that will be accessible only when the user is logged in. We can surely set this constraint for each controller separately, but we will do it in a better way.

How to do it...

  1. First, we will need a base controller that our user-only controllers will use. Let's create SecureController.php in the protected/components directory with the following code:

    <?php
    class SecureController extends Controller
    {
        public function filters()
        {
            return array(
                'accessControl',
            );
        }
    
        public function accessRules()
        {
            return array(
                array('allow', 
      ...

Using external actions


In Yii, you can define controller actions as separate classes and then connect them to your controllers. This way, you can reuse some common functionality.

For example, you can move the backend for autocomplete fields to an action and save some time by not having to write it over and over again.

Another simple example that we will review is deleting a model.

Getting ready

  1. Set up a new application using yiic webapp.

  2. Create a database schema with the following script:

    CREATE TABLE `post` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `created_on` int(11) unsigned NOT NULL,
      `title` varchar(255) NOT NULL,
      `content` text NOT NULL,
      PRIMARY KEY  (`id`)
    );
    
    
    CREATE TABLE `user` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `username` varchar(200) NOT NULL,
      `password` char(40) NOT NULL,
      PRIMARY KEY  (`id`)
    );
  3. Generate the Post and User models using Gii. Add some data to the tables.

How to do it...

  1. Let's write protected/controllers/PostController.php. It is a usual...

Displaying static pages with CViewAction


If you have a few static pages and aren't going to change them very frequently, then it's not worth querying the database and implementing page management for them.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. We just need to connect CViewAction to our controller.

    class SiteController extends CController
    {
       function actions()
       {
          return array(
             'page'=>array(
                'class'=>'CViewAction',
            ),
          );
       }
    }
  2. Now, put your pages into protected/views/site/pages, and name them about.php and contact.php.

  3. Now, you can try your pages by typing in the URL http://example.com/index.php?r=site/page&view=contact.

  4. Alternatively, you can type in the URL http://example.com/site/page/view/about, if you have configured clean URLs with a path format.

How it works...

We connect the external action named CViewAction that simply tries to find a view named the same as the $_GET parameter supplied. If it is there...

Using flash messages


When you are editing a model with a form, when you are deleting a model, or doing any other operation, it is good to tell users if it went well or if there was an error. Typically, after some kind of action, such as editing a form, a redirect will happen and we need to display a message on the page we want to go to. However, how do we pass it from the current page to the redirect target and clean up afterwards? Flash messages will help us.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. Let's create a protected/controllers/WebsiteController.php controller as follows:

    class WebsiteController extends CController
    {
       function actionOk()
       {
          Yii::app()->user->setFlash('success', 'Everything went fine!');
          $this->redirect('index');
       }
    
       function actionBad()
       {
          Yii::app()->user->setFlash('error', 'Everything went wrong!');
          $this->redirect('index');
       }
    
       function actionIndex()
       {
          $this->render...

Using the controller context in a view


Yii views are pretty powerful and have many features. One of them is that you can use controller context in a view. So, let's try it.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. Create a controller as follows:

    class WebsiteController extends CController
    {   
       function actionIndex()
       {
          $this->pageTitle = 'Controller context test';
          $this->render('index');
       }
    
       function hello()
       {
          if(!empty($_GET['name']))
             echo 'Hello, '.$_GET['name'].'!';
       }
    }
  2. Now, we will create a view showing what we can do:

    <h1><?php echo $this->pageTitle?></h1>
    <p>Hello call. <?php $this->hello()?></p>
    <?php $this->widget('zii.widgets.CMenu',array(
       'items'=>array(
          array('label'=>'Home', 'url'=>array('index')),
          array('label'=>'Yiiframework home', 'url'=>'http://yiiframework.ru/'),
       ),
    ))?>
  3. In order to test it you can follow /index.php...

Reusing views with partials


Yii supports partials, so if you have a block without much logic that you want to reuse or want to implement e-mail templates, partials are the right way to go about this.

Getting ready

  1. Set up a new application using yiic webapp.

  2. Create WebsiteController as follows:

    class WebsiteController extends CController
    {
       function actionIndex()
       {
          $this->render('index');
       }
    }
  3. Set up a database using the following SQL:

    CREATE TABLE `user` (
      `id` int(10) unsigned NOT NULL auto_increment,
      `name` varchar(200) NOT NULL,
      `email` varchar(200) NOT NULL,
      PRIMARY KEY  (`id`)
      );
  4. Use Gii to generate the User model.

  5. Add some data to the user table.

How to do it...

We will start with a reusable block. For example, we need to embed a YouTube video on several website pages. Let's implement a reusable template for it.

  1. Create a view file named protected/views/common/youtube.php and paste an embed code from YouTube. You will get something like the following:

    <object width...

Using clips


One of the Yii features you can use in your views is clips . The basic idea is that you can record some output and then reuse it later in a view. A good example would be defining additional content regions for your layout and filling them elsewhere.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. For our example, we need to define two regions in our layout: beforeContent and footer. Open protected/views/layouts/main.php and insert the following code line just before the content output (<?php echo $content; ?>):

    <?php if(!empty($this->clips['beforeContent'])) echo $this->clips['beforeContent']?>

    Then, insert the following into <div id="footer">:

    <?php if(!empty($this->clips['footer'])) echo $this->clips['footer']?>
  2. That is it! Now, we need to fill these regions somehow. We will use a controller action for the beforeContent region. Open protected/controllers/SiteController.php and add the following code to actionIndex:

    $this...

Using decorators


In Yii, we can enclose content into a decorator. The common usage of decorators is layout. Yes, when you are rendering a view using the render method of your controller, Yii automatically decorates it with the main layout. Let's create a simple decorator that will properly format quotes.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. First, we will create a decorator file, protected/views/decorators/quote.php:

    <div class="quote">
       &ldquo;<?php echo $content?>&rdquo;, <?php echo $author?>
    </div>
  2. Now in protected/views/site/index.php, we will use our decorator:

    <?php $this->beginContent('//decorators/quote', array('author' => 'Edward A. Murphy'))?>
    If anything bad can happen, it probably will
    <?php $this->endContent()?>
  3. Now, your home page should include the following markup:

    <div class="quote">
       &ldquo;If anything bad can happen, it probably will&rdquo;, Edward A. Murphy
    </div>

How...

Defining multiple layouts


Most applications use a single layout for all their views. However, there are situations when multiple layouts are needed. For example, an application can use different layouts on different pages: two additional columns for blogs, one additional column for articles, and no additional columns for portfolios.

Getting ready

Set up a new application using yiic webapp.

How to do it...

  1. Create two layouts in protected/views/layouts: blog and articles. Blog will contain the following code:

    <?php $this->beginContent('//layouts/main')?>
    <div>
    <?php echo $content?>
    </div>
    <div class="sidebar tags">
       <ul>
          <li><a href="#php">PHP</a></li>
          <li><a href="#yii">Yii</a></li>
       </ul>
    </div>
    <div class="sidebar links">
       <ul>
          <li><a href="http://yiiframework.com/">Yiiframework</a></li>
          <li><a href="http://php.net/"&gt...

Paginating and sorting data


In the latest Yii releases, the focus was moved from using Active Record directly to grids, lists, and data providers. Still, sometimes it is better to use Active Record directly. Let's see how to list paginated AR records with the ability to sort them.

Getting ready

  1. Set up a new application using yiic webapp.

  2. Create a database structure table post with id and title as fields, and add 10 to 20 records.

  3. Generate the Post model using Gii.

How to do it...

  1. First, you need to create protected/controllers/PostController.php:

    class PostController extends Controller
    {
      function actionIndex()
      {
        $criteria = new CDbCriteria();
        $count=Post::model()->count($criteria);
        $pages=new CPagination($count);
    
        // elements per page
        $pages->pageSize=5;
        $pages->applyLimit($criteria);
    
        // sorting
        $sort = new CSort('Post');
        $sort->attributes = array(
           'id',
           'title',
        );
        $sort->applyOrder($criteria);
    
        $models = Post::model...
Left arrow icon Right arrow icon

Key benefits

  • Learn how to use Yii even more efficiently
  • Full of practically useful solutions and concepts you can use in your application
  • Both important Yii concept descriptions and practical recipes are inside

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.

Who is this book for?

This book is for developers with good PHP5 knowledge who have tried to develop applications using Yii. An object-oriented approach and MVC knowledge will be a great advantage as Yii uses these extensively.

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
Estimated delivery fee Deliver to Switzerland

Standard delivery 10 - 13 business days

€11.95

Premium delivery 3 - 6 business days

€16.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 25, 2013
Length: 408 pages
Edition : 2nd
Language : English
ISBN-13 : 9781782163107
Vendor :
Microsoft
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Switzerland

Standard delivery 10 - 13 business days

€11.95

Premium delivery 3 - 6 business days

€16.95
(Includes tracking information)

Product Details

Publication date : Apr 25, 2013
Length: 408 pages
Edition : 2nd
Language : English
ISBN-13 : 9781782163107
Vendor :
Microsoft
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 57.98
Yii Application Development Cookbook - Second Edition
€37.99
Instant Building Multi-Page Forms with Yii How-to
€19.99
Total 57.98 Stars icon

Table of Contents

13 Chapters
Under the Hood Chevron down icon Chevron up icon
Router, Controller, and Views Chevron down icon Chevron up icon
AJAX and jQuery Chevron down icon Chevron up icon
Working with Forms Chevron down icon Chevron up icon
Testing Your Application Chevron down icon Chevron up icon
Database, Active Record, and Model Tricks Chevron down icon Chevron up icon
Using Zii Components Chevron down icon Chevron up icon
Extending Yii Chevron down icon Chevron up icon
Error Handling, Debugging, and Logging Chevron down icon Chevron up icon
Security Chevron down icon Chevron up icon
Performance Tuning Chevron down icon Chevron up icon
Using External Code Chevron down icon Chevron up icon
Deployment Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(14 Ratings)
5 star 50%
4 star 28.6%
3 star 7.1%
2 star 0%
1 star 14.3%
Filter icon Filter
Top Reviews

Filter reviews by




P. Wright Apr 06, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A book you'll keep referring to, so that's got to be good. Exactly what it says on the cover "recipe" so you pick and choose and adapt the code to suit your own projects. You'll need to have had a play with Yii , "get" the whole framework thing, be an OOPHP convert and be ready to build your first project. Although its possible to find most of what you want to do online, I still enjoy a book to read and see the techniques used in the context of a project feature or function. I think its a great supplement to online documentation and can help you make better sense of it. I've enjoyed reading this book.
Amazon Verified review Amazon
R. Engelmann Sep 13, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Nichts für Anfänger, aber wer schon mal was mit Yii gemacht hat und sein Wissen vertiefen möchte, für den ist das Buch genau richtig. Liest sich gut und es kommen interessante Tips drin vor...
Amazon Verified review Amazon
Abdelaziz Bennouna Jun 14, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
DISCLAIMER: I got a free review copy of the eBook version of "Yii Application Development Cookbook - Second Edition" from the publisher.I was really excited to dive into Alexander Makarov's Yii book, mainly because he is a member of the Yii framework core team, and also one of the most helpful contributors in the Yii forum. I however took the time to read the book from cover to cover over a week, and while I've read each recipe including the printed code, I haven't tested any specific one.I personally like cookbooks, but this one shouldn't be relied on to learn Yii from scratch, as it is intended for PHP developers that are already familiar with the framework. It lists 90 recipes split over the same 13 independent chapters that were already organizing the first edition. One of the issues with that approach is that you end up with recipe groups rather than logical chapters, but that shouldn't stop you from studying and testing individual recipes.This edition corrects the errata found in the first one (and adds a few), and uses a more comfortable monospace font for code listings and code words. Compared to the first edition, all original recipes seem to be kept in place, and there are only 3 new ones. For the lazy, Alexander Makarov also created a GitHub repository with the code provided in most of the recipes.What I specially liked in this cookbook is that the author shares his deep knowledge of Yii's core mechanisms, and implements beautiful reusable code in efficient --and tasteful-- efficient recipes, with a steady goal of performance. And although the recipes are independent, some are in fact linked or complementary, and each can be learnt and used straight away without any prerequisite. It however took me some recipes --the whole first chapter in fact-- to get used to the "How to do it.../How it works..." structure.It's a pity that the table of contents is rather conservative and names recipes after Yii features or concepts, and not according to the recipe result. I would have preferred recipes named like "Learn to code a complete to-do webapp in Yii using REST, JSON, and doT" instead of (or in addition to) "Rendering content at the client side", or at least an alternative summary with recipes' achievements.The intrinsic value of most of recipes is high or very high: I rated most of them 4 or 5/5. One outstanding exception is the "Chapter 7: Using Zii Components" because its 4 recipes are below par, and what can be found in the Yii Wikis regarding Zii widgets usage and customization is far more interesting.I rate "Yii Application Development Cookbook - Second Edition" 4,5/5 to leave some room of improvement. It is nonetheless an excellent addition to Yii books in general and provides several unique and enlightening recipes that are extremely useful and inspiring to the serious Yii 1.1.x developer.
Amazon Verified review Amazon
Amazon Customer Jun 16, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The cookbook covers practical Yii application development tips which will help you develop better applications, and it also has recipes for important Yii features which are very useful to know.The book is written by Alexander Makarov who is an experienced engineer from Russia and has been a Yii framework core team member since 2010. He also was the technical reviewer for three other books related to Yii, so you can be sure the cookbook is written by someone who knows inner workings of Yii framework.The cookbook has a similar format to other PacktPub cookbooks and is easy to follow, but you should have at least a basic understanding on how Yii framework works before starting with recipes. The recipes are split to 13 chapters that will show you how to use Yii efficiently.The cookbook contains 90 recipes (if my finger counting is correct) and covers a wide range of topics. Recipes could be categorized in: simple recipes (you're probably already using them), advanced (or good to know) recipes, complex recipes (which will need more fiddling around to completely understand how they work) and recipes which will make you question yourself "Why the hell I'm not using this in my application?".If you're serious about learning Yii framework you should definitely buy this book. Even if you already have a good understanding of Yii framework I'm sure you will find recipes which will make you even better. Of course if you're just thinking about learning Yii framework you shouldn't start with this book.You can find a more in-depth review at the following page http://www.ifdattic.com/2013/06/02/review-of-yii-application-development-cookbook-se
Amazon Verified review Amazon
Amr Feb 07, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is essential if you want to master YII. The book also explains some of the most advanced features you'll need to build a rich Yii website.If you want to save your time and learn Yii in short time, follow as much as you can from this book
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon