In this comprehensive Hindi tutorial, we explore the types of controllers in Yii2 Framework including web\Controller, console\Controller, rest\Controller, and rest\ActiveController.
Whether you're building a web application, command-line tool, or REST API, understanding controllers is essential in Yii2.
What you'll learn in this video:
Types of Controllers in Yii2:
yii\web\Controller for handling web requests
yii\console\Controller for command-line applications
yii\rest\Controller and yii\rest\ActiveController for REST APIs
Web Controller Basics:
Creating new controller actions
Route structure: controllerID/actionID, moduleID/controllerID/actionID
Naming conventions for controllers:
article → ArticleController
post-comment → PostCommentController
admin/post-comment → admin\PostCommentController
adminPanels/post-comment → adminPanels\PostCommentController
Inline vs Standalone Actions:
How inline actions like actionIndex and actionHelloWorld work
Creating custom standalone actions using Action classes
Using controllerMap to map controllers to modules or alternate paths
Action Parameters & Results:
Passing parameters like id, name to actions
Returning different types of responses (views, redirects)
Default Actions:
How to set a default action using public $defaultAction = 'home';
Controller Lifecycle:
Understand what happens from request to response inside a controller
Console Controllers in Yii2:
Creating console controller actions
Naming conventions for commands and actions
Demonstrating a console feature using a simple interactive game
How to reuse a standalone action in both web and console apps using:
This tutorial is perfect for anyone working with Yii2 Basic or Advanced templates and wanting to understand Yii2’s controller system deeply.
Don't forget to like, comment, and subscribe for more Yii2 tutorials in Hindi.
Chapters-
0:01 - Introduction
1:28 - What is a Web Controller in Yii2
4:17 - Defining New Actions in Web Controllers
5:45 - Route Structure: controllerID/actionID or moduleID/controllerID/actionID
7:09 - Controller Naming Conventions
9:15 - Module Like Structure for Controllers Without Module
12:45 - Controller Map and Usage
14:45 - Alias Set for View in render
16:08 - Action Results and Redirects
17:16 - Standalone Actions
24:53 - Action Parameters
27:47 - Setting Default Action
29:07 - Redirection
29:57 - Controller Lifecycle
31:13 - What is a Console Controller in Yii2
32:14 - Creating Actions in Console
33:25 - Console Command Naming Conventions
35:27 - Implementing Interactive Console Commands
41:06 - Creating Standalone Actions for Console
Yii2 Documentation - https://www.yiiframework.com/doc/guid...
Follow on Linkedin -
/ dynamic-duniya
/ aayushmhu
My Recording Gears-
Microphone - https://amzn.to/46kYtO0
#Yii2Framework
#Yii2TutorialHindi
#PHPBackendDevelopment
#WebControllerYii2
#ConsoleControllerYii2
#Yii2Modules
#Yii2RoutingHindi
#PHPWebDevelopment
#Yii2ForBeginners
#ActionMethodsYii2
#CustomRoutingYii2
#StandaloneActionsYii2
#ControllerLifecycleYii2
#RESTControllerYii2
#Yii2PrettyURL
#BackendDevelopmentHindi
#WebDevelopmentHindi
#PHPHindiTutorial
#Yii2AdvancedTutorial
#LearnYii2Hindi
On this page of the site you can watch the video online Yii2 Web and Console Controllers Explained | Inline Actions, Controller Map, Parameters | Tutorial 8 with a duration of hours minute second in good quality, which was uploaded by the user Dynamic Duniya 03 August 2025, share the link with friends and acquaintances, this video has already been watched 82 times on youtube and it was liked by 6 viewers. Enjoy your viewing!