Search by

icanboogie / routing

olvlvl

Request routing

Package info

github.com/ICanBoogie/Routing

Homepage

pkg:composer/icanboogie/routing

Statistics

Installs: 6 651

Dependents: 3

Suggesters: 0

Stars: 5

Open Issues: 2

v6.0.0 2024-11-29 13:33 UTC

README

Packagist Code Coverage Downloads

The icanboogie/routing package handles URL rewriting in native PHP. A Request is mapped to a Route, which in turn is mapped to a Responder. If the process is successful a response is returned. Events are emitted along the way to allow listeners to alter the request or the response, or recover from failure.

The following example is an overview of request processing. The routing components are part of the stack of responder providers.

<?php

namespace ICanBoogie\HTTP;

/* @var ResponderProvider $responder_provider */

// The request is usually created from the $_SERVER super global.
$request = Request::from($_SERVER);

// The Responder Provider matches a request with a Responder
$responder = $responder_provider->responder_for_request($request);

// The Responder responds to the request with a Response, it might also throw an exception.
$response = $responder->respond($request);

// The response is sent to the client.
$response();

Installation

composer require icanboogie/routing

Documentation

New to the package? Follow Getting started. The full index is in docs/.

Continuous Integration

The project is continuously tested by GitHub Actions.

Tests Static Analysis Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.

Contributing

See CONTRIBUTING for details.