Urlmanager : Handling Rest Requests

I want the below syntax of yii 1.1.* to be converted into yii2




...

'urlManager'=>array(

    'urlFormat'=>'path',

    'rules'=>array(

        'post/<id:\d+>/<title:.*?>'=>'post/view',

        'posts/<tag:.*?>'=>'post/index',

        // REST patterns

        array('api/list', 'pattern'=>'api/<model:\w+>', 'verb'=>'GET'),

        array('api/view', 'pattern'=>'api/<model:\w+>/<id:\d+>', 'verb'=>'GET'),

        array('api/update', 'pattern'=>'api/<model:\w+>/<id:\d+>', 'verb'=>'PUT'),

        array('api/delete', 'pattern'=>'api/<model:\w+>/<id:\d+>', 'verb'=>'DELETE'),

        array('api/create', 'pattern'=>'api/<model:\w+>', 'verb'=>'POST'),

        // Other controllers

        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

    ),

),

...



With Yii 2 it’s much better to use REST features: http://stuff.cebe.cc/yii2docs/guide-rest.html