2017 © Pedro Peláez
 

library route-priority

Package to add priority to Laravel 5 routes

image

snizhok/route-priority

Package to add priority to Laravel 5 routes

  • Thursday, January 4, 2018
  • by snizhok
  • Repository
  • 1 Watchers
  • 0 Stars
  • 131 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 5 Versions
  • 14 % Grown

The README.md

Package to add priority to Laravel 5 routes

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Installation

1) Add langaner/route-priority to composer.json., (*2)

"langaner/route-priority": "dev-master"

2)Run composer update to pull down the latest version of the package., (*3)

3)Now open up app/config/app.php and add the service provider to your providers array., (*4)

Langaner\RoutePriority\RoutePriorityServiceProvider::class,

4)Add the trait to App\Http\Kernel, (*5)

use \Langaner\RoutePriority\RouterTrait;

Usage

Change routes priority:, (*6)

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

Default Priority

Default priority is 50. Higher priority - values from 50 and above, lower priority - 49 and below., (*7)

Usage example

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

In this example second route will not work. Add priority 0 to the first route will fix the error:, (*8)

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

Second route now has higher priority., (*9)

Group priority

You can put priority to groups:, (*10)

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';
    });
});

Second group has higher priority then First group. All routes in the group will has the same priority as the group., (*11)

The Versions

04/01 2018

5.3.x-dev

5.3.9999999.9999999-dev

Package to add priority to Laravel 5 routes

  Sources   Download

MIT

The Requires

 

by Avatar langaner

laravel route priority

19/12 2017

dev-master

9999999-dev

Package to add priority to Laravel 5 routes

  Sources   Download

MIT

The Requires

 

by Avatar langaner

laravel route priority

16/09 2017

5.4.x-dev

5.4.9999999.9999999-dev

Package to add priority to Laravel 5 routes

  Sources   Download

MIT

The Requires

 

by Avatar langaner

laravel route priority

16/03 2016

1.0.1

1.0.1.0

Package to add priority to Laravel 5 routes

  Sources   Download

MIT

The Requires

 

by Avatar langaner

laravel route priority

15/03 2016

1.0

1.0.0.0

Package to add priority to Laravel 5 routes

  Sources   Download

MIT

The Requires

 

by Avatar langaner

route laravel 5 priority