Download the PHP package hexbit/router without Composer

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

Wordpress Router

CI

A simple PHP router built on SymfonyHttpFoundation and AltoRouter based on laravel API. This library is actually built to make routing easier on the RootsSage starter framework, however it can also be used in other systems

Installation

Usage

Creating Routes

Map Methods

Creating a route is done using the map function:

In wordpress

If you do not use the WordPress system, use the router class below, and you can attempt to match your current request in appropriate time.

map() takes 3 parameters:

Route Parameters

Parameters can be defined on routes using the {keyName} syntax. When a route matches that contains parameters, an instance of the RouteParams object is passed to the action. Second parameter is an instance of Symfony\Component\HttpFoundation\Request which contains the information of the current request.

Named Routes

Routes can be named so that their URL can be generated programatically:

If the route requires parameters you can be pass an associative array as a second parameter:

HTTP Verb Shortcuts

Typically you only need to allow one HTTP verb for a route, for these cases the following shortcuts can be used:

Setting the basepath

The router assumes you're working from the route of a domain. If this is not the case you can set the base path:

Controllers

If you'd rather use a class to group related route actions together you can pass a Controller String to map() instead of a closure. The string takes the format {name of class}@{name of method}. It is important that you use the complete namespace with the class name.

Example:

Creating Groups

It is common to group similar routes behind a common prefix. This can be achieved using Route Groups:

Matching Routes to Requests

Once you have routes defined, you can attempt to match your current request against them using the match() function. match() accepts an instance of Symfony's Request and returns an instance of Symfony's Symfony\Component\HttpFoundation\Response:

If you return an instance of Response from your closure it will be sent back un-touched. If however you return something else, it will be wrapped in an instance of Response with your return value as the content.

on not found

If no route matches the request, a boolean false will be returned as match response.

Wordpress Virtual Pages

This feature allows you to create template pages on the fly, and there is no need to have that page in the database.

Now voila! loads virtual page template.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
altorouter/altorouter Version ^2.0
symfony/http-foundation Version ^5.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 hexbit/router contains the following files

Loading the files please wait ....