PHP code example of snizhok / route-priority

1. Go to this page and download the library: Download snizhok/route-priority 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/ */

    

snizhok / route-priority example snippets


Route::get('test', ['uses' => 'Controller@showAction'])->setPriority(100);

Route::get('/test/{slug}', …);
Route::get('/test/hello', …);

Route::get('/test/{slug}', …)->setPriority(0);
Route::get('/test/hello', …);

Route::group(['prefix' => 'test-group', 'priority' => 10], function () {
	Route::get('/test/hello', function () {
	    return 'First group';
	});
});

Route::group(['prefix' => 'test-group', 'priority' => 20], function () {
	Route::get('/test/hello', function () {
	    return 'Second group';
	});
});