2017 © Pedro Peláez
 

yii2-extension yii2-url-manager

Useful url rules for url manager.

image

mg-code/yii2-url-manager

Useful url rules for url manager.

  • Friday, April 21, 2017
  • by mg-code
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,900 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 44 % Grown

The README.md

yii2-url-manager

Useful url rules for url manager., (*1)

Install

Either run, (*2)

$ php composer.phar require mg-code/yii2-url-manager "@dev"

or add, (*3)

"mg-code/yii2-url-manager": "@dev"

to the require section of your composer.json file., (*4)

Usage

Once the extension is installed, you can use url rules:, (*5)

HostUrlRule

Filters url rules by host name. Useful if your application works on multiple domains/subdomains., (*6)

return [
    'class' => 'yii\web\UrlManager',
    ......
    'rules' => [
       ['class' => 'mgcode\urlManager\HostUrlRule', 'host' => 'payment.example.com', 'rules' => [
            ['pattern' => '/', 'route' => '/payment/default/index'],
        ]],
    ]
];

RedirectUrlRule

Redirects user to destination route if current request matched. Simply configure as any other url rule. You can specify statusCode, defaults to: 301., (*7)

return [
    'class' => 'yii\web\UrlManager',
    ......
    'rules' => [
        ['pattern' => '/some-old-link', 'route' => '/new/action', 'class' => 'mgcode\urlManager\RedirectUrlRule'],
    ]
];

See Yii Routing and URL Creation for more detail., (*8)

The Versions

21/04 2017

dev-master

9999999-dev https://github.com/mg-code/yii2-url-manager

Useful url rules for url manager.

  Sources   Download

BSD 3-Clause

The Requires

 

by Maris Graudins

extension yii2 host url manager url rule

22/07 2016

1.0.0

1.0.0.0 https://github.com/mg-code/yii2-url-manager

Useful url rules for url manager.

  Sources   Download

BSD 3-Clause

The Requires

 

by Maris Graudins

extension yii2 host url manager url rule