2017 © Pedro Peláez
 

yii2-extension yii2-autorouter

This component allows modules to create rules for UrlManager by method

image

mikbox74/yii2-autorouter

This component allows modules to create rules for UrlManager by method

  • Thursday, August 24, 2017
  • by MikUrrey
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

yii2-autorouter

This component allows modules to create rules for UrlManager by method., (*1)

Installing:, (*2)

composer require mikbox74/yii2-autorouter, (*3)

Step 1: add the component in bootstrap list of your application (main.php, main-local.php) like here:, (*4)

return [
    // ...
     'bootstrap' => [
         [
             'class' => \mikbox74\Autorouter\AutorouterComponent::class,
         ],
         //...
     ],
];

Step 2: make your module class to implement \mikbox74\Autorouter\AutorouterInterface then add a method getUrlRules() and make it returning a rule array as if you configure the module's rules in main.php or main-local.php, like in the example:, (*5)

 public static function getUrlRules()
 {
     return [
         [
             'class' => 'yii\rest\UrlRule',
             'controller' => [
                 'mymodule/controller',
             ],
         ],

         'GET  mymodule/controller/<id:\d+>'   => 'mymodule/controller/view',
         'POST mymodule/controller'            => 'mymodule/controller/create',
         'PUT mymodule/controller/<id:\d+>'    => 'mymodule/controller/update',
         'DELETE mymodule/controller/<id:\d+>' => 'mymodule/controller/delete',
     ];
 }

The Versions

24/08 2017

1.0.1

1.0.1.0

This component allows modules to create rules for UrlManager by method

  Sources   Download

MIT

by Michail Urakov

24/08 2017

dev-master

9999999-dev

This component allows modules to create rules for UrlManager by method

  Sources   Download

MIT

by Michail Urakov

24/08 2017

1.0.0

1.0.0.0

This component allows modules to create rules for UrlManager by method

  Sources   Download

MIT

by Michail Urakov