Download the PHP package suitetea/quick-routes without Composer
On this page you can find all versions of the php package suitetea/quick-routes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download suitetea/quick-routes
More information about suitetea/quick-routes
Files in suitetea/quick-routes
Package quick-routes
Short Description QuickRoutes simplifies and shortens mundane and repeated declaration of routes and controller methods.
License MIT
Informations about the package quick-routes
Quick Routes for Laravel
Do you ever find yourself declaring the same types of routes over and over again through multiple controllers even though they all do and look basically the same thing/way? That's where Quick Routes comes in.
Turn this:
into this:
*you can specify which routes to use, or simply use all ("*")
The magic happens by setting default routes in an array either through a config file or setting it.
There are multiple ways to set the default routes.
1) The package config found in "app/config/suitetea/quick-routes" (available after publish package config).
2) Calling QuickRoutes::setDefault()
and passing in a properly formatted array.
3) Overriding the defaults per register call. There is an option third parameter part of register
that you can pass routes to be used instead of the global defaults.
Additionally, you can group routes by using different default sets. Ex:
New in 0.8.0
Fixed a bug where if a HTTP method wasn't specified, the previously declared method was used, resulting in unexpected and unwanted results.
The second parameter in the register
method is now optional. If not set, all routes will be used by default. The exception to this is when overriding the default route set for a single instance. In this case, the asterisk ('*') may still be used.
Introduced with
method. Using with
merges default routes with a set of routes given for a single instance.
For example, this:
is equivalent to this:
Also, you can define a custom uses value, including a Closure:
$image_routes = [ 'img_create' => [ 'pattern' => 'create/image' 'methods' => ['post'], 'uses' => function() { return Redirect::route('image.view'); } ] ];
New in 0.7.0
You can now create multiple methods per route, just pass the methods parameter as an array.
Installation
Via Composer
The default routes array should be in the following format:
Optionally, you can publish the package config file and set default routes there.