Download the PHP package dlpwd/router without Composer

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

dlpwd-router

Lightweight router library with named url parameters

Basic Usage

Configuring Routes

The router supports three request methods, GET, POST and DELETE. There are corresponding methods in the router class to add routes for each request method

$_method

The request method can be specified when using the addRoute method on the router to create a new route. This method is useful when adding routes in bulk, for example after loading from a database or file, rather than using hard-coded routes.

$_url

The URL for the route should be specified with a leading forward-slash. Trailing forward-slashes are optional. The router will match requests with and without a trailing forward-slash to the same route. Parameters are specified within curly-braces. The name of the parameters must match the name of the parameters on the handler function, otherwise they will not be passed through

$_handler

The handler argument specifies the function to call if the route matches. The function can be specified in as any valid PHP callable

Resolving Routes

To have the router examine a URL and call the relevant controller, execute the resolve method. The resolve method will return any value returned by the controller function

$_url

Omitting or passing null to the $_url parameter will cause the router to use the value of $_SERVER['REQUEST_URI']. Pass a url to this argument to manually run the router for a different URL than the one being requested

$_method

Omitting or passing null to the $_method parameter will cause the router to use the value of $_SERVER['REQUEST_METHOD']. Pass a method to this argument to override that value. Most useful when manually running the router with a different URL as above


All versions of router 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 dlpwd/router contains the following files

Loading the files please wait ....