PHPackages                             black-lamp/yii2-redirect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. black-lamp/yii2-redirect

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

black-lamp/yii2-redirect
========================

Is a component for configuration of redirects from controller actions to routes or previous page

00PHP

Since Feb 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/black-lamp/yii2-redirect)[ Packagist](https://packagist.org/packages/black-lamp/yii2-redirect)[ RSS](/packages/black-lamp-yii2-redirect/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Redirect behavior for Yii2
==========================

[](#redirect-behavior-for-yii2)

Is a component for configuration of redirects from controller actions to routes or previous page

[![Latest Stable Version](https://camo.githubusercontent.com/3a8e9c23a1a58f9a3d94b1a37dab84dd4de80c553826b7ebf878c7f8b1c73191/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d72656469726563742f762f737461626c65)](https://packagist.org/packages/black-lamp/yii2-redirect)[![Latest Unstable Version](https://camo.githubusercontent.com/483b4ca1d3c12fd0f987af95bc8838366536647722b7bea0f51bf897b73fd5ad/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d72656469726563742f762f756e737461626c65)](https://packagist.org/packages/black-lamp/yii2-redirect)[![License](https://camo.githubusercontent.com/56ed3d9e118e3dbefcba427d6c9ec483857fed424a195a6a98e20702d8a2f3ef/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d72656469726563742f6c6963656e7365)](https://packagist.org/packages/black-lamp/yii2-redirect)

Installation
------------

[](#installation)

Run command

```
composer require black-lamp/yii2-redirect

```

or add

```
"black-lamp/yii2-redirect": "dev-master"
```

to the require section of your composer.json.

Using
-----

[](#using)

Add behavior to your controller

```
public function behaviors()
{
   return [
        'redirect' => [
            'class' => \bl\redirect\RedirectBehavior::class,
            'actions' => [
            ]
        ],
   ];
}
```

and configure redirects in the `actions` array

```
// ...
'class' => \bl\redirect\RedirectBehavior::class,
'actions' => [
    'register' => ['/news'],
    'send-request' => ['/user'],
    // ...
]
```

array key it's a action ID and the value of the array it's a route to redirect.

If you leave route empty like this

```
'actions' => [
    'register' => [],
    // ...
]
```

action will be redirected to request referrer.

If referrer is empty - action will be redirected to route from `\yii\web\User::getReturnUrl()`. You can change this route if you use `\yii\web\User::setReturnUrl()` method.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1784ec992318bf7ed40a2025a0ca035a01143de89054f0f4c9bc39469928c1?d=identicon)[GutsVadim](/maintainers/GutsVadim)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (6 commits)")

---

Tags

black-lampphpyii-extensionyii2

### Embed Badge

![Health badge](/badges/black-lamp-yii2-redirect/health.svg)

```
[![Health](https://phpackages.com/badges/black-lamp-yii2-redirect/health.svg)](https://phpackages.com/packages/black-lamp-yii2-redirect)
```

###  Alternatives

[psr7-sessions/storageless

Storageless PSR-7 Session support

650396.3k8](/packages/psr7-sessions-storageless)[roots/wp-stage-switcher

WordPress plugin that allows you to switch between different environments from the admin bar

374458.3k3](/packages/roots-wp-stage-switcher)[mnastalski/baselinker-php

Base.com (formerly BaseLinker) PHP library

1635.7k](/packages/mnastalski-baselinker-php)[beholdr/filament-trilist

Filament plugin that adds components for working with tree data: treeselect and treeview

1124.6k](/packages/beholdr-filament-trilist)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
