LaravelPackages.net
Acme Inc.
Toggle sidebar
sleeping-owl/route-priority

Package to add priority to Laravel routes

252
5
1.1.0
About sleeping-owl/route-priority

sleeping-owl/route-priority is a Laravel package for package to add priority to laravel routes. It currently has 5 GitHub stars and 252 downloads on Packagist (latest version 1.1.0). Install it with composer require sleeping-owl/route-priority. Discover more Laravel packages by sleeping-owl or browse all Laravel packages to compare alternatives.

Last updated

Package to add priority to Laravel routes

Latest Stable Version License

Installation

Add sleeping-owl/route-priority to composer.json.

"sleeping-owl/route-priority": "1.*"

Run composer update to pull down the latest version of the package. Now open up app/config/app.php and add the service provider to your providers array.

'providers' => array(
    'SleepingOwl\RoutePriority\RoutePriorityServiceProvider'
)

That's it. You now have some enhanced functionality available to your routes.

Usage

Now you can change your routes priority:

Route::get('my-route', ['uses' => 'MyController@myAction'])->setPriority(100);

Priority is integer value.

Default Priority

Default priority is 50 - already registered routes count. So if you want higher priority - use values from 50 and above, lower priority - 10 and below.

Example

Route::get('/user/{wildcard}', );
Route::get('/user/settings', );

This code will register two routes. With default Laravel behaviour second route will not work. Just add priority to the first route to fix the error:

Route::get('/user/{wildcard}', )->setPriority(0);
Route::get('/user/settings', );

Second route now has higher priority and will work.

Support Library

You can donate in BTC: 13k36pym383rEmsBSLyWfT3TxCQMN2Lekd

Package was written by Sleeping Owl for the Laravel framework and is released under the MIT License. See the LICENSE file for details.

Comments