Download the PHP package onesimus-systems/osrouter without Composer

On this page you can find all versions of the php package onesimus-systems/osrouter. 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 osrouter

OSRouter

OSRouter is a simple, fast HTTP router for PHP. It can perform simple routes with variable and optional URL parts. OSRouter can extract parts of a URL as variable that can be passed to a closure or a controller method.

Requirements

Usage

The main methods are Router::get(), ::post(), and ::any(). The signature for each is ($pattern, $callback, $options = []). \$pattern is the URI pattern the route will match using the format /static/{variable}/{?option-variable}. \$callback is either a string such as Controller@method or a closure function. \$options can be a single string in which case it will interpreted as a single filter, or it can be an array with the syntax ['filter' => ['filter1', 'filter2']]. The outer array is to allow for extra options that may be added later on.

To route in an application located in a subdirectory of the webserver, you'll need to remove the directory prefix from the REQUEST_URI field in the Request object. For example, if the base of your application was located at http://example.com/blog, you will need to strip "/blog" from the request uri before processing a route. Otherwise, all routes will be checked against "/blog/something" instead of just "/something".

You can also register routes in a group

Groups are defined using the Router::group(array $options, array $routes) method. \$options is a keyed array with the keys 'filter', 'prefix', and 'rprefix'. 'Filter' is an array of filters that apply to the group. A single filter can be given as a string as well. 'Prefix' is a prefix added to the HTTP pattern in each group. In the example above, the routes will be /admin/groups/{?id} and /admin/users/{?id}. 'Rprefix' is prepended to each controller statement. For example, if 'rprefix' => '\Namespace\Admin\' was added to the group above, the controller statements would be \Namespace\Admin\Controller@groups and \Namespace\Admin\Controller@user.

Note: Closures cannot be assigned to a route defined in a group. To assign a closure, assign the route separately.

You can define a 404 route using the method Router::register404Route($callback, $options = []). If no 404 route is defined and a route isn't found, a RouteException will be thrown.

Filters

Filters can be defined and assigned to routes. Routes can have multiple filters, they will be handled in the order they're defined on the route. If all filters return a non-falsey value, the route will be green-lit and the dispatch will continue. Otherwise a FailedFilterException will be thrown. Also, a RouteException will be thrown if the filter isn't defined.

Example:

When the above route is dispatched, the 'auth' filter will be executed and if it returns a non-falsey value, the AdminController will be given control as normal. You can define multiple filters using an array.

In this case both filters must return truthy.

Router\Http\Request

Router\Http\Response


All versions of osrouter with dependencies

PHP Build Version
Package Version
No informations.
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 onesimus-systems/osrouter contains the following files

Loading the files please wait ....