Download the PHP package webiik/router without Composer

On this page you can find all versions of the php package webiik/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 router

Router

The Router is passive, multi-lingual regex router. It supports route names, route parameters, route controllers and route middleware. Passive means that it doesn't set HTTP headers and it doesn't invoke route controllers and middleware. It just tests a request URI against the defined routes and returns all necessary data to build a route.

Installation

Example

Configuration

setBaseURI

setBaseURI() sets the base directory of your index.php file relatively to web-server root.

Every time your index.php file isn't in the web-server root directory, you have to set dir in which is located.

setDefaultLang

setDefaultLang() sets the default language of routes without defined $lang parameter. $defaultLang must be two characters long. The default value is en.

setDefaultLangInURI

setDefaultLangInURI() determines if default language is part of URI e.g. /en/. The default value is FALSE.

Adding

addRoute

addRoute() adds NewRoute to the Router and returns NewRoute.

Parameters:

Check

match

match() checks if current request URI matches some of defined route and returns Route.

getHttpCode

getHttpCode() returns http code of the result of last match().

Getting

getBaseURL

getBaseURL() returns base URL of your app e.g. https://www.webiik.com

getURI

getURI() returns route's URI. If it can't find the route or some of the required route parameters is missing, then it returns the empty string. After calling getURI(), you can get missing parameters by calling getMissingParameters()

getURL

getURL() same as getURI(), but returns full URL.

getMissingParameters

getMissingParameters() returns missing parameters after calling getURI() or getURL().

getRegexParameters

getRegexParameters() returns array with route regex parameters e.g. ['0' => '(?\<name>[a-z])?', '1' => '([a-z])']. If the route doesn't exist, it returns false.

Route

The Route is the result of match(). It contains handy information about the current route.

getController

getController() returns array with route controller and controller method to run.

getName

getName() returns route name.

getLang

getLang() returns route language.

getMw

getMw() returns array with route middleware.

getParameters

getParameters() returns parameters injected during Route construction e.g. ['name' => 'dolly', '1' => 'dolly', '2' => 'hello'].

Resources


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 webiik/router contains the following files

Loading the files please wait ....