sleeping-owl/route-priority

Package to add priority to Laravel routes
251 5
Install
composer require sleeping-owl/route-priority
Latest Version:1.1.0
PHP:>=5.4.0
License:MIT
Last Updated:Feb 5, 2015
Links: GitHub  ·  Packagist
Maintainer: sleeping-owl

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

Copyright and License

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

Related Packages

langaner/route-priority

Package to add priority to Laravel 5 routes

4,370 7
spatie/laravel-authorize

A middleware to check authorization

26,518 203
cariboufute/locale-route

A testable route package with localization for Laravel 5

7,023 20
sjdaws/apirouter

Configurable router for Laravel 5

43 4
maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up ea...

383,659 25