Download the PHP package jasonlewis/enhanced-router without Composer

On this page you can find all versions of the php package jasonlewis/enhanced-router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package enhanced-router

Enhanced Router

Enhanced Router is an extension to the Laravel 4 router and provides some enhanced functionality.

Build Status

Installation

Add jasonlewis/enhanced-router to composer.json.

"jasonlewis/enhanced-router": "1.0.*"

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

'providers' => array(
    'JasonLewis\EnhancedRouter\EnhancedRouterServiceProvider'
)

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

Features

Using Enhanced Router

Once you have the package installed and the service provider in your providers key you can begin using the features right away.

Route Group Prefixes

Using the Laravel 4 router there is no way to set a requirement on a prefix. What this means is that prefixes themselves are hard-coded. There are a number of real-world scenarios where being able to use variable prefixes is very useful.

Let's say you're building an application that has localization support and you're currently prefixing all your routes with the locale.

For a small application this might suffice. But once your application gets quite large it can become a bit of a smell. And when it comes time to add another language you'll need to go through all the routes and add the language.

Using Enhanced Router you can set the requirement itself on the group. This means you only need to define the requirement once, and adding languages in the future isn't so painful.

Parameters

It's important to note that the locale is actually given to each route as a parameter. The parameter is also given to every method of every controller that is within the group. When your route requires a parameter of its own it will be given after the prefix parameter.

Subdomain Routing

Using route groups in Laravel 4 you can specify the domain the group responds to. This is especially helpful when you want to route to a subdomain. Currently you can only route to a single subdomain or every subdomain.

The first group will match example.laravel.dev and the second will match any subdomain. Using the exact same syntax as prefixes you can also set the requirement on the subdomain.

Now the group will only match the subdomains jason.laravel.dev and shawn.laravel.dev.

Filters

Route Groups

Filters can now be applied to a group using the fluent syntax you might be familiar with from routes. The only thing to be aware of here is that you still need to provide an array as the first parameter to the group.

All filters in the group will now have the auth filter applied to them. When you have nested groups with filters applied to them the outermost filters are applied first since they are actually defined first.

The above example would trigger the auth filter first and then move on to the csrf filter if the matched route was within that group.

Because of type hinting in the Laravel 4 router it's difficult to remove the empty array from the first parameter. If you aren't using a prefix or subdomain routing then you can use the new bunch method.

This method is the same as group except you don't have to pass in an array as the first parameter.

HTTP Verbs

Enhanced Router allows you to apply filters to all routes for specific HTTP verbs. Consider an application where all POST requests require the csrf filter.

Or you can use an array of verbs.

You can also use an array of filters to apply.

More Examples

This example shows how you can nest groups and use filters, domains, and prefixes all at once.

Changes

v1.0.3

v1.0.2

v1.0.1

v1.0.0

License

Released under the 2-clause BSD. Copyright 2013 Jason Lewis.


All versions of enhanced-router with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version 4.0.*
illuminate/routing Version 4.0.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jasonlewis/enhanced-router contains the following files

Loading the files please wait ....