PHP code example of cyneek / yii2-routes

1. Go to this page and download the library: Download cyneek/yii2-routes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cyneek / yii2-routes example snippets


'bootstrap' => ['log', 'routes'];
...
'components' => [
	'route' => [
		'class' => 'cyneek\yii2\routes\components\route',
	],
]
...
'modules' => [
	'routes' => [
		'class' => 'cyneek\yii2\routes\Module',
		'routes_dir' => array('../routes')
	]
	// set custom modules here
],

'modules' => [
		'routes' => [
            'class' => 'cyneek\yii2\routes\Module',
			'active' => FALSE
		]
		// set custom modules here
    ],

Route::match(['GET', 'POST'], 'user', 'user/index');

Route::set_name('user_update', 'admin/user/load/');

Route::get('user', 'user/index', ['as' => 'user']);

echo Route::named('user');

redirect(Route::named('user'));

Route::group(['prefix' => 'admin', 'filter' => 'logged_in'], function(){
     Route::post('update/(:any)', 'user/update');
});