Yii2 Application Development Solutions–Volume 2
3.0 (2 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
21 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Yii2 Application Development Solutions–Volume 2 to your Wishlist.

Add to Wishlist

Yii2 Application Development Solutions–Volume 2

Explore the advanced concepts of the Yii2 framework to create modern web applications quickly…
3.0 (2 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
21 students enrolled
Created by Packt Publishing
Last updated 4/2017
Current price: $10 Original price: $125 Discount: 92% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 3 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Implement your own Yii extension and make your extension reusable and useful for the Community
  • Configure Yii to gain extra performance
  • Learn best practices for developing an application that will run smoothly until you have very high loads
  • Learn how to show everyone except the developer a maintenance message.
  • Add an advanced configuration system to the yii2-app-basic application template
  • Use the best technologies for testing, such as Codeception, PhpUnit, Atoum, and Behat.
  • Write simple tests and avoid regression errors in your application.
  • Review logging, analyze exception stack traces, and implement your own error handler.
View Curriculum
  • The sections in this video are independent and offer a practical approach to Yii development. All videos are explained with step-by-step code examples and real-world business logic.

Yii is an optimal, high-performance PHP framework for developing Web 2.0 applications. It provides fast, secure, and professional features to create robust projects; however, this rapid development requires the ability to organize common tasks collectively to build a complete application. Being extremely performance-optimized, Yii is the perfect choice for projects of any size. It comes packaged with tools to help test and debug your application and has clear and comprehensive documentation.

This video course is a collection of Yii2 videos. Each video is represented as a full and independent item, showcasing solutions from real web applications. So you can easily reproduce them in your environment and learn Yii2 rapidly and painlessly…

In this video, you will get started by configuring your Yii2 application. After that, we will focus on how to make our extension as efficient as possible. Then we will cover some best practices for developing an application that will run smoothly until you have very high loads. Moving ahead, we will provide various tips, which are especially useful in application deployment and when developing an application in a team. Later, we will introduce the best technologies for testing and we will see how to write simple tests and avoid regression errors in our application.

Finally, we conclude this course by discussing review logging, analyzing the exception stack trace, and implementing our own error handler.

About the Authors

Andrew Bogdanovis a seasoned web developer from Yekaterinburg, Russia with more than six years of experience in industrial development. Since 2010, he has been interested in the Yii and MVC frameworks. He has taken part in projects written in Yii, such as a work aggregator for a UK company, high-load projects, real-estate projects, and the development of private projects for the government.

He has worked on various CMS and frameworks using PHP and MySQL, including Yii, Kohana, Symphony, Joomla, WordPress, CakePHP, and so on. Also, he is adroit at integrating third-party APIs such as Payment gateways (PayPal, Facebook, Twitter, and LinkedIn). He is very good in slicing and frontend, so he can provide full information about the Yii framework.

He is also well-versed in PHP/MYSQL, Yii 1.x.x, Yii 2.x.x, Ajax, Jquery, MVC frameworks, Python, LAMP, HTML/CSS, Mercurial, Git, AngularJS, and adaptive markup.

In his free time, he likes to visit and talk with new people and discuss web development problems. He is currently working with professionals.

Dmitry Eliseev has been a web developer since 2008 and specializes in server-side programming on the PHP and PHP frameworks. 

Dmitry is interested in developmental best practices, software architectures, object-oriented programming, and other approaches.

He is an author and a presenter of practical courses about the principles and best practices of object-oriented programming and the use of version control systems. Also, he is an author of webinars, the Yii2 Framework, and common developmental subjects. He practices teaching and counseling by development on frameworks and using the principles of software design and improvements in common code quality. This is his first book.

Alexander Makarov is an experienced engineer from Russia and has been a Yii framework core team member since 2010. Before joining the Yii core team, he participated in the growth of the CodeIgniter community in Russia. In 2009, he finished the Russian translation of the framework documentation and created the Russian community website. In 2012, he released the Russian version of the book along with Russian community members. In the same year, he was a technical reviewer for three more books:

  •     The Yii Book: Developing Web Applications Using the Yii PHP Framework, Larry Ullman
  •     Web Application Development with Yii and PHP, Jeff Winesett
  •     Yii Rapid Application Development Hotshot, Lauren O'Meara, and James Hamilton

In his free time, Alexander speaks at conferences, and enjoys movies, music, traveling, photography, and languages. He currently resides in Voronezh, Russia with his beloved wife and daughter. 

Who is the target audience?
  • This video is targeted at developers with a good knowledge of the PHP 5 and MVC frameworks, and those who have tried to develop applications using the Yii 1.x.x version. If you have still not tried Yii2, then this video is definitely for you!
Students Who Viewed This Course Also Viewed
Curriculum For This Course
41 Lectures
Configuring Your Yii2 Application
5 Lectures 24:36

This video gives an overview of entire course.

Preview 07:34

The aim of this video is to explore ElasticSearch engine adapter, which is an ActiveRecord-like wrapper for ElasticSearch full text search engine integration into the Yii2 framework.

ElasticSearch Engine Adapter

The aim of this video is to learn about Gii code generator that provides a web-based code generator called Gii for Yii 2 applications.

Gii Code Generator

Pax is a widget that integrates the PJax jQuery plugin. All content that is wrapped by this widget will be reloaded by AJAX without refreshing the current page.

PJax jQuery Plugin

The aim of this video is to learn about Redis database driver, which allows you to use Redis key-value storage in any project on the Yii2 framework.

Redis Database Driver
Extending Yii
12 Lectures 47:54

There are a lot of built-in framework helpers such as StringHelper in the yii\helpers namespace. These contain sets of helpful static methods for manipulating strings, files, arrays, and other subjects.

Preview 02:40

There are many similar leading products such as Google's Gmail that define nice UI patterns. One of these is soft delete. Instead of a permanent deletion with tons of confirmations, Gmail allows us to immediately mark messages as deleted and then easily undo it. The same behavior can be applied to any object such as blog posts, comments, and so on.

Creating Model Behaviors

You may have some code that looks like it can be reused but you don't know if it's a behavior, widget, or something else, most probably it's a component.

Creating Components

Common actions such as deleting the AR model by the primary key or getting data for AJAX autocomplete could be moved into reusable controller actions and later attached to controllers as needed.

Creating Reusable Controller Actions

In Yii, you can create reusable controllers. If you are creating a lot of applications or controllers that are of the same type, moving all common code into a reusable controller will save you a lot of time.

Creating Reusable Controllers

A widget is a reusable part of a view that not only renders some data but also does it according to some logic. It can even get data from models and use its own views, so it is like a reduced reusable version of a module.

Creating a Widget

Yii has good command-line support and allows creating reusable console commands. Console commands are faster to create than web GUIs. If you need to create some kind of utility for your application that will be used by developers or administrators, console commands are the right tool.

Creating CLI Commands

A filter is a class that can run before/after an action is executed. It can be used to modify execution context or decorate output.

Creating Filters

If you have created a complex application part and want to use it with some degree of customization in your next project, most probably you need to create a module.

Creating Modules

Yii2 only offers native PHP templates. If you want to use one of the existing template engines or create your own one, you have to implement it—of course, if it's not yet implemented by the Yii community. Here we will re-implement the Smarty templates support.

Creating a Custom View Renderer

Yii2 provides built-in i18n support for making multilanguage applications. In this video, we are translating the application interface to different languages.

Creating a Multilanguage Application

The aim of this video is to talk about how to share your results with people and why it's important.

Making Extensions Distribution-Ready
Performance Tuning
7 Lectures 36:26

The aim of this video is to follow the best practices.

Preview 05:49

Native session handling in PHP is fine in most cases. The aim of this video is to speed up the session handling.

Speeding Up Session Handling

Yii supports many cache backends, but what really makes the Yii cache flexible is the dependency and dependency chaining support. There are situations when you cannot simply cache data for an hour because the information cached can be changed at any time.

Using Cache Dependencies and Chains

If all of the best practices for deploying a Yii application are applied and you still do not have the performance you want, then most probably there are some bottlenecks with the application itself. The main principle while dealing with these bottlenecks is that you should never assume anything and always test and profile the code before trying to optimize it.

Profiling an Application with Yii

Instead of only server-side caching implementation, you can use client-side caching via specific HTTP-headers.

Leveraging HTTP Caching

If your web page includes many CSS and/or JavaScript files, the page will open very slowly because the browser sends a large number of HTTP requests to download each fie in separated threads. To reduce the number of requests and connections, we can combine and compress multiple CSS/JavaScript files into one or very few files in production mode, and then include these compressed files on the page instead of the original ones.

Combining and Minimizing Assets

HHVM transforms PHP code into intermediate HipHop bytecode (HHBC) and dynamically translates PHP code into machine code, which will be optimized and natively executed.

Running Yii2 on HHVM
8 Lectures 27:07

By default, we have the Basic and Advanced Yii2 application skeletons with different directory structures. But these structures are not dogmatic, and we can customize them if required.

Preview 03:48

By default, Yii2 applications work from the web directory for your site's entry script. But shared hosting environments are often quite limited when it comes to the configuration and directory structure. You cannot change the working directory for your site.

Moving an Application Webroot

By default, Yii2's Advanced template has console, frontend, and backend applications. However, in your specific case, you can rename the existing ones and create your own applications

Changing an Advanced Application Template

In the basic application template we have separated web and console configuration files. And usually we set some application components in the both the configuration files. Moreover, when we develop a big application, we may face some inconvenience.

Moving Configuration Parts into Separate Files

What problem does this video deal with and what is the solution the viewer is looking for?

Using Multiple Configurations to Simplify the Deployment

Sometimes, an application requires some background tasks, such as regenerating a site map or refreshing statistics. A common way to implement this is by using cron jobs. When using Yii, there is a way to use a command to run as a job.

Implementing and Executing Cron Jobs

Sometimes, there is a need to fine tune some application settings or restore a database from a backup. When working on tasks such as these, it is not desirable to allow everyone to use the application because it can lead to losing the recent user messages or showing the application implementation details.

Maintenance Mode

There are many tools available for automating the deployment process. The aim of this video is to consider the tool named Deployer.

Deployment Tools
4 Lectures 32:50

By default, the basic and advanced Yii2 application skeletons use Codeception as a testing framework. Codeception supports writing of unit, functional, and acceptance tests out of the box.

Preview 15:36

PHPUnit is the most popular PHP testing framework. It is simple for configuration and usage. Also, the framework supports code coverage reports and has a lot of additional plugins.

Unit Testing with PHPUnit

Besides PHPUnit and Codeception, Atoum is a simple unit testing framework. You can use this framework for testing your extensions or for testing a code of your application.

Unit Testing with Atoum

Behat is a BDD framework for testing your code with human-readable sentences that describes code behavior in various use cases.

Unit Testing with Behat
Debugging, Logging, and Error Handling
5 Lectures 20:06

Logging is the key to understanding what your application actually does when you have no chance to debug it. If we are expecting unusual behavior in our application, we need to know about it as soon as possible and have enough details to reproduce it. This is where logging comes in handy.

Preview 06:52

When an error occurs, Yii can display the error stack trace along with the error. A stack trace is especially helpful when we need to know what really caused an error rather than just the fact that an error occurred.

Analyzing the Yii Error Stack Trace

If you are following the best practices and developing and testing an application with all possible errors reported, you can get an error message. However, without the execution context, it is only telling you that there was an error and it is not clear what actually caused it.

Logging and Using the Context Information

In Yii, the error handling is very flexible, so you can create your own error handler for errors of a specifi type.

Displaying Custom Errors

The Yii2-debug extension is a powerful tool for debugging own code, analyzing request information or database queries, and so on.

Custom Panel for Debug Extension
About the Instructor
Packt Publishing
3.9 Average rating
8,109 Reviews
58,251 Students
686 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.