Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

bahirul/yii2-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 Redirect

Simple yii2 redirect component.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require bahirul/yii2-redirect

or add

"bahirul/yii2-redirect": "^0.0.1"

to the require section of your composer.json file.

Configuring

Configure application components as follows

return [
    //...
    'components' => [
        //...
        'redirect' => [
            'class' => 'bahirul\yii2\Redirect',
        ],
    ],
];

Usage

Use in your controller action

Redirect to URL

return Yii::$app->redirect->to($url)->go(); //redirect only

Redirect with flash message

return Yii::$app->redirect->to($url)->flash($flash_name, $flash_message)->go(); //redirect with flash message

Redirect to previous page

return Yii::$app->redirect->prev()->go(); //redirect to previous page or home page (if previous page is null)

Redirect to Login page

return Yii::$app->redirect->login()->go(); //redirect to login page

About

Simple Yii2 redirect component

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages