PHPackages                             cornernote/yii-return-url - 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. cornernote/yii-return-url

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cornernote/yii-return-url
=========================

Maintain the state of Return Urls across multiple tabs.

1.0.3(11y ago)15.8k2BSD-3-ClausePHP

Since Dec 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/cornernote/yii-return-url)[ Packagist](https://packagist.org/packages/cornernote/yii-return-url)[ RSS](/packages/cornernote-yii-return-url/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (5)Used By (2)

Yii ReturnUrl
=============

[](#yii-returnurl)

Maintain the state of Return Urls by using the request.

[![Mr PHP](https://camo.githubusercontent.com/5c2a4e06b8343bc0132af3775a46e3cbe9b40f69708f11bf40869fc560fdde17/68747470733a2f2f7261772e6769746875622e636f6d2f636f726e65726e6f74652f6d727068702d6173736574732f6d61737465722f696d672f636f64652d62616e6e65722e706e67)](http://mrphp.com.au) [![Project Stats](https://camo.githubusercontent.com/d210cf6642dcc49c3f3b7962046513a8305f8958e910e9d2a9a429665349b46d/68747470733a2f2f7777772e6f686c6f682e6e65742f702f7969692d72657475726e2d75726c2f776964676574732f70726f6a6563745f7468696e5f62616467652e676966)](https://www.ohloh.net/p/yii-return-url)

[![Latest Stable Version](https://camo.githubusercontent.com/20c026f7de858055772704357c5d610e0637350d8374b6c19e636ec0ba882b50/68747470733a2f2f706f7365722e707567782e6f72672f636f726e65726e6f74652f7969692d72657475726e2d75726c2f762f737461626c652e706e67)](https://packagist.org/packages/cornernote/yii-return-url) [![Build Status](https://camo.githubusercontent.com/a3ca74664b618f5efc1e5fd563366258a15ca3b10e00172ba4dc1879a79080b0/68747470733a2f2f7472617669732d63692e6f72672f636f726e65726e6f74652f7969692d72657475726e2d75726c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/cornernote/yii-return-url)

You might be saying, Yii already handles a returnUrl perfectly fine with the `CWebUser::getReturnUrl()` and `CWebUser::setReturnUrl()` methods. Why not use those?

These methods store the returnUrl into a single variable in the users session. This becomes a flaw when we have multiple tabs open. Take the following scenario:

- A user navigates to a page that sets a returnUrl. The page is for a form they have to complete.
- The phone rings, and they are required to fill in a different form. They achieve this by opening another tab.
- As they navigate to the new page, their old returnUrl is overwritten by the new one, they complete the second form and everything seems normal.
- They then return to their first form, and after submission they get taken to the second returnUrl and their navigation path appears broken.

The solution is to pass the returnUrl into the GET and POST request by embedding it into your links and forms. This extension makes it very easy to do and solves many common problems including the maximum length of a GET request.

### Contents

[](#contents)

[Features](#features)
[Installation](#installation)
[Configuration](#configuration)
[Usage](#usage)
[License](#license)
[Links](#links)

Features
--------

[](#features)

- Allows a URL to be consistant with the page the user is viewing, even if they open other tabs.
- Easily embed return URLs into your links or forms.
- Handles very long returnUrl values by passing a key in the GET params.

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

[](#installation)

Please download using ONE of the following methods:

### Composer Installation

[](#composer-installation)

```
curl http://getcomposer.org/installer | php
php composer.phar require cornernote/yii-return-url

```

### Manual Installation

[](#manual-installation)

Download the [latest version](https://github.com/cornernote/yii-return-url/archive/master.zip) and move the `yii-return-url` folder into your `protected/extensions` folder.

Configuration
-------------

[](#configuration)

Add the path to yii-return-url to the `components` in your yii configuration:

```
return array(
	'components' => array(
		'returnUrl' => array(
			'class' => 'vendor.cornernote.yii-return-url.components.EReturnUrl',
			// if you downloaded into ext
			//'class' => 'ext.yii-return-url.components.EReturnUrl',
		),
		'cache'=>array(
			// cache is required for this extension
			'class' => 'CFileCache',
			//'class' => 'CMemCache',
			//'class' => 'CApcCache',
		),
	),
);
```

Usage
-----

[](#usage)

Your user is on a search results page, and you have a link to an update form. After filling in the form you want the user to be returned to the page they started from.

On the start page, add a returnUrl to your link, for example in `views/post/index.php`:

```
// generate a returnUrl link value
// pass true so that it points to the current page
$returnUrlLinkValue = Yii::app()->returnUrl->getLinkValue(true);
CHtml::link('edit post', array('post/update', 'id' => $post->id, 'returnUrl' => $returnUrlLinkValue));
```

On the update page, add a returnUrl to your form, for example in `views/post/update.php`:

```
// generate a returnUrl form value
// pass false so that it points to the returnUrl from the request params provided by your link
$returnUrlFormValue = Yii::app()->returnUrl->getFormValue(false);
CHtml::hiddenField('returnUrl', $returnUrlFormValue);
```

In the controller action that handles the form, change the call to `$this->redirect()`, for example in `Post::actionUpdate()`

```
$altUrl = array('post/index'); // this is where we used to redirect to, we use it as a failback
$this->redirect(Yii::app()->returnUrl->getUrl($altUrl));
```

License
-------

[](#license)

- Author: Brett O'Donnell
- Author: Zain Ul abidin
- Source Code:
- Copyright © 2013 Mr PHP
- License: BSD-3-Clause

Links
-----

[](#links)

- [Yii Extension](http://www.yiiframework.com/extension/return-url)
- [Composer Package](https://packagist.org/packages/cornernote/yii-return-url)
- [MrPHP](http://mrphp.com.au)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~166 days

Total

4

Last Release

4074d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c84a589344489e8195ec1c6afcfa3abcc23a73092ceaa4ca60da96355c4d16?d=identicon)[cornernote](/maintainers/cornernote)

---

Top Contributors

[![cornernote](https://avatars.githubusercontent.com/u/51875?v=4)](https://github.com/cornernote "cornernote (20 commits)")

---

Tags

yiimrphpreturnUrl

### Embed Badge

![Health badge](/badges/cornernote-yii-return-url/health.svg)

```
[![Health](https://phpackages.com/badges/cornernote-yii-return-url/health.svg)](https://phpackages.com/packages/cornernote-yii-return-url)
```

###  Alternatives

[rmrevin/yii2-fontawesome

Asset Bundle for Yii2 with Font Awesome

1474.2M135](/packages/rmrevin-yii2-fontawesome)[kartik-v/yii2-helpers

A collection of useful helper functions for Yii Framework 2.0

883.1M29](/packages/kartik-v-yii2-helpers)[kartik-v/yii2-icons

Set of icon frameworks for use in Yii Framework 2.0

691.0M34](/packages/kartik-v-yii2-icons)[kartik-v/yii2-datecontrol

Date control module allowing separation of formats for View and Model for Yii Framework 2.0

551.5M37](/packages/kartik-v-yii2-datecontrol)[cebe/yii2-gravatar

Gravatar Widget for Yii 2

391.8M35](/packages/cebe-yii2-gravatar)[cornernote/gii-modeldoc-generator

Gii ModelDoc Generator for Yii framework

12110.1k](/packages/cornernote-gii-modeldoc-generator)

PHPackages © 2026

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