Download the PHP package chimera/routing without Composer

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

Chimera - routing

Total Downloads Latest Stable Version Unstable Version

Build Status Code Coverage

The term Chimera (/kɪˈmɪərə/ or /kaɪˈmɪərə/) has come to describe any mythical or fictional animal with parts taken from various animals, or to describe anything composed of very disparate parts, or perceived as wildly imaginative, implausible, or dazzling.

There are many many amazing libraries in the PHP community and with the creation and adoption of the PSRs we don't necessarily need to rely on full stack frameworks to create a complex and well designed software. Choosing which components to use and plugging them together can sometimes be a little challenging.

The goal of this set of packages is to make it easier to do that (without compromising the quality), allowing you to focus on the behaviour of your software.

This particular package provides PSR-15 middleware and reusable request handlers that help you to expose command and query handlers using HTTP as the web mechanism.

Installation

You probably won't depend directly on this package, but it is available on Packagist, and can be installed it using Composer:

PHP Configuration

In order to make sure that we're dealing with the correct data, we're using assert(), which is a very interesting feature in PHP but not often used. The nice thing about assert() is that we can (and should) disable it in production mode so that we don't have useless statements.

So, for production mode, we recommend you to set zend.assertions to -1 in your php.ini. For development you should leave zend.assertions as 1 and set assert.exception to 1, which will make PHP throw an AssertionError when things go wrong.

Check the documentation for more information: https://secure.php.net/manual/en/function.assert.php

Components

Extension points

The packages that extend this library should implement two basic interfaces, they're used to abstract how each routing library works:

Route parameters extraction middleware

This middleware uses an implementation of Chimera\Routing\RouteParamsExtractor to put the parameters of the matched route in a standard attribute, so that other components can retrieve them.

Request handlers

Usage

Middleware pipeline

As mentioned above content negotiation is not a responsibility of the request handlers. It's expected that you configure lcobucci/content-negotiation-middleware to process such task and it should be put in the very beginning of the pipeline, so that it can process any unformatted response.

The Chimera\Routing\RouteParamsExtractor middleware should be put right after the middleware responsible for matching routes (which changes for each implementation).

So a middleware pipeline in a Zend Expressive v3 application would look like this - considering that all services are properly configured in the DI container:

Routes

The main idea of this package is to move your application's behaviour to the command and query handlers, which allows them to be reused by different delivery mechanism. This means that the logic of the request handlers are pretty much reusable, therefore you end up having less code to maintain.

Considering that you have configured the command and query buses with the correct handlers and also that you have mapped the instances of the request handlers in your dependency injection container, you just need to configure the PSR-15 router to add the handlers to the correct endpoint.

In a Zend Expressive v3 application the config/routes.php would look like this:

License

MIT, see LICENSE.


All versions of routing with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
chimera/foundation Version ^0.4
fig/http-message-util Version ^1.1
lcobucci/content-negotiation-middleware Version ^3.0
middlewares/negotiation Version ^2.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.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 chimera/routing contains the following files

Loading the files please wait ....