Learning Yii 2

First steps into web application development with Yii 2
3.9 (32 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.
163 students enrolled
Take This Course
  • Lectures 31
  • Length 3 hours
  • Skill Level Beginner Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 11/2015 English

Course Description

Yii is the premium PHP framework for developing web applications. It provides components to simplify every aspect of web development, including authentication, authorization, and automated testing, offering a comprehensive ORM called ActiveRecord, and the option to perform performance tuning. We can use all of these features out-of-the-box, or even customize them based on our project requirements.

The more applications we develop for the web, the more aware we become that we’re spending time on the same repetitive tasks. Learning Yii 2 demonstrates how it is entirely possible to write quality applications fast. This course will show you how to create a basic but fully functional dating site for monsters. All this with minimal effort on your part, because the Yii framework simplifies the overhead work.

We’ll start by installing Yii's basic application template via Vagrant. Before you know it, you’ll have a fully-functional web application that is ready to be customized. You’ll learn to generate Models, Views, and Controllers, and debug and test them with the Debug Toolbar and Codeception. As we continue, you’ll learn to modify that generated code to create a registration page, a profile page, and a listing page, as well as a search interface using ActiveQuery and TypeAhead. We’ll also use ACF and RBAC to boost the security of our website.

By the end, you’ll be comfortable using Yii 2 to develop your own personal and professional web applications.

About The Author

Matthew Beaumont has been interested in technology since his father brought home a Radio Shack TRS-80 in the late 1980s. After six years in music school, he returned to the technology field and founded Beaumont Web Development, LLC, which is a boutique web-development firm located just across the Hudson River from New York City. In addition to his development work, he also plays classical percussion and has appeared in concerts at Lincoln Center, Carnegie Hall, and Radio City Music Hall. He has also published several articles on web development for Sitepoint.

What are the requirements?

  • It would also be helpful to have a basic understanding of HTML, CSS, and Twitter Bootstrap.

What am I going to get from this course?

  • Set up a development environment for your application
  • Scaffold Models, Views and Controllers quickly using Gii
  • Write automated tests using the Codeception testing framework
  • Make a secure environment using ACF and RBAC
  • Manage stylesheets and Javascript with the AssetManager
  • Keep view code clean with HTMLHelper
  • Build a robust search UI with ActiveQuery and TypeAhead
  • Create alternate themes for your site
  • Send e-mails using SwiftMailer
  • Translate your application into multiple languages

Who is the target audience?

  • While no previous experience with the Yii framework is required for you to benefit from this course, it is recommended that have a good understanding of PHP’s object-oriented features.
  • This course will walk you through every step of building a basic functional web application in a practical and detailed but fun way.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Introducing Yii 2.0

This video will offer the overview of the course.


It takes a lot of time to set up a development environment for an application. Learn how to quickly create and configure a development environment on our local PC, so we can begin programming our application.


Learn how to easily install the Yii 2 basic application template, which is the starting point for any Yii-based project.


Understand where Yii stores various files within the basic application template.


Introduce application components, describe how to change their default configuration, and then explain how to extend a core component to add functionality.

Section 2: Introducing Yii's Development Tools

Learn how to configure Gii, which is a tool that quickly generates code templates in order to cut development time dramatically.


Learn to generate models with Yii, and then describe Yii’s model features.


Learn to generate controllers with Gii, and then describe Yii’s controller features.


The presentation logic in an application should be isolated, and contain a minimal amount of PHP. We’ll learn how to generate views using Gii as well as how to use them.


Learn how to configure and use Yii's built-in debugging module.

Section 3: Testing with Yii and Codeception

Automated testing can be difficult to configure and implement. Yii ships with an integrated version of the Codeception testing framework in order to simplify the process of writing automated tests.


Learn how to use Codeception to write and execute unit tests for our application.


Learn how to use Codeception to write and execute functional tests for our application.


Learn how to use Codeception to write and execute acceptance tests for our application.

Section 4: Creating and Managing Users

Every application needs a means to authenticate users. We’ll explore the auto-generated User model that comes with the Yii 2 basic application template.


The default user is very limited and requires changes to the code to add users or edit their data. We’ll create a better user using the database and then learn how to easily hash their password.


The application doesn’t have a way to easily create new users. We will create a registration page to allow new users to create accounts.


Guests (users who have not logged in) should not be able to update and delete profiles. Use Access Control Filter to restrict access to these pages.


ACF only allows the ability to block access to controller actions. For finer-grained over access to application features, use the AuthManager component to implement Role Based Access Control (RBAC).

Section 5: Adding Some Style

Some visual aspects of a web application are common to multiple pages, and having to update those aspects in each page would be very tedious. We’ll learn how to use Yii layouts to manage our common UI elements.


Applications often have many frontend assets that have dependencies as well as potential conflicts. The Yii 2 AssetBundle class helps keep Javascript and CSS organized.


Dynamic web applications often mix too much HTML and PHP in order to generate HTML content. The HtmlHelper attempts to solve this by providing PHP methods to generate clean HTML.


The current profile (view) page is not very appealing, so we'll use some of the skills we've learned in the previous videos to spice it up.

Section 6: Finding Love

A dating site needs a method for users to search for their match. Yii’s ActiveQuery component makes generating complex SQL queries very easy.


Sometimes, simply presenting a user with a text field in a search UI leaves them feeling overwhelmed. We can use the TypeAhead widget to provide meaningful suggestions for search terms.


We've been using the GridView widget to display results, but it is really more suitable in an admin panel than a customer-facing page. We’ll learn how to use the ListView widget to improve the appearance of our listing page.


Sometimes, an application needs multiple themes in order to display data in different ways to different users or under different circumstances. We’ll learn how to use themes to address this issue.

Section 7: Beyond the Basics

Applications frequently need to send e-mails. We’ll learn how to use the built-in Swiftmailer component in order to easily send HTML e-mails.


Our application requires users to manually copy images to the photo directory, which they wouldn’t have access to in production. We’ll learn how to upload files through a form with Yii, and then learn how to manipulate them using the Imagine extension.


Managing database changes with multiple .sql files is slow and prone to error. Yii’s migration class helps manage database changes.


Not everyone speaks the same language. So, we’ll learn how to use the i18n component of Yii in order to translate our application into other languages.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Packt Publishing, 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.

Ready to start learning?
Take This Course