PHPackages                             yidas/yii2-helpers - 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. yidas/yii2-helpers

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

yidas/yii2-helpers
==================

A collection of useful helpers for Yii Framework 2.0

1.2.2(8y ago)134BSD-3-ClausePHP

Since Nov 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/yidas/yii2-helpers)[ Packagist](https://packagist.org/packages/yidas/yii2-helpers)[ Docs](https://github.com/yidas/yii2-helpers)[ RSS](/packages/yidas-yii2-helpers/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

Yii2 Helpers
============

[](#yii2-helpers)

Collection of useful helpers for Yii Framework 2.0

[![Latest Stable Version](https://camo.githubusercontent.com/0cbca7f4bb8edcf494678c23e2e20d24edadc2093b43667aa809128277f681f2/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f796969322d68656c706572732f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/yii2-helpers)[![Latest Unstable Version](https://camo.githubusercontent.com/64b1b3696d6c4a71253715c3eb612127220ea9cebc7d0a1e6d2a23b208126939/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f796969322d68656c706572732f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/yii2-helpers)[![License](https://camo.githubusercontent.com/450ba8fe701cb54d2ea381667aac539ddb0469e3e3facef2055c8c51fbea4048/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f796969322d68656c706572732f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/yii2-helpers)

HELPERS
-------

[](#helpers)

- **[Route](#route)**
    Validate current route status belonging to the given scope.
- **[RouteJS](#routejs)**
    Redirector by JS base calling in Controller
- **Navigation**
    Web locator saving location and providing validation.

---

INSTALLATION
------------

[](#installation)

Install from composer command:

```
$ php composer.phar require yidas/yii2-helpers

```

Or, in yii2 `composer.json`, manually require yidas/yii2-helpers.

```
"require": {
        ...
        "yidas/yii2-helpers": "*"
    },

```

---

DOCUMENTATION
-------------

[](#documentation)

### Route

[](#route)

#### Usage: (Supposing the current controller route is 'site/index')

[](#usage-supposing-the-current-controller-route-is-siteindex)

```
Route::in('site');          // True for site/*
Route::is('site/index');    // True for site/index
Route::get();               // Get such as 'site/index'
Route::getByLevel(1);       // Get 'site' from 'site/index'

// Root Level usage for filtering prefix from route
Route::setRootLevel(1);     // Set the rootLevel to 1
Route::get();               // Get 'index' from 'site/index'
Route::setRootLevel();      // Get the rootLevel back to 0
Route::get();               // Get 'site/index' from 'site/index'
```

#### Example in View:

[](#example-in-view)

```
