Download the PHP package andrewcarteruk/simple-route without Composer

On this page you can find all versions of the php package andrewcarteruk/simple-route. 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 simple-route

SimpleRoute

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Total Downloads License

This easy to use router is a simple wrapper for the FastRoute library.

By AndrewCarterUK (Twitter)

Install

Install using Composer.

Example Usage

Documentation

The following documentation is derived from the FastRoute documentation.

Routes are defined as an array of SimpleRoute\Route objects that are passed to SimpleRoute\Router::fromArray(array $routes).

SimpleRoute\Route objects require a $method, a $pattern and a $handler:

The $method is an uppercase HTTP method string for which a certain route should match. It is possible to specify multiple valid methods using an array:

By default the $pattern uses a syntax where {foo} specifies a placeholder with name foo and matching the regex [^/]+. To adjust the pattern the placeholder matches, you can specify a custom pattern by writing {bar:[0-9]+}.

Some examples:

Custom patterns for route placeholders cannot use capturing groups. For example {lang:(en|de)} is not a valid placeholder, because () is a capturing group. Instead you can use either {lang:en|de} or {lang:(?:en|de)}.

Furthermore parts of the route enclosed in [...] are considered optional, so that /foo[bar] will match both /foo and /foobar. Optional parts are only supported in a trailing position, not in the middle of a route.

The $handler parameter does not necessarily have to be a callback, it could also be a controller class name or any other kind of data you wish to associate with the route. SimpleRoute only tells you which handler corresponds to your URI, how you interpret it is up to you.

Credits

This library is merely a wrapper for FastRoute that aims to provide an easier to use API.

The author of FastRoute is Nikita Popov.


All versions of simple-route with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
nikic/fast-route Version ^0.7
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 andrewcarteruk/simple-route contains the following files

Loading the files please wait ....