The HTTP component for the Sauber PHP framework

Fund package maintenance!
juststeveking

dev-main 2022-05-30 10:11 UTC

This package is not auto-updated.

Last update: 2024-06-08 21:40:31 UTC


README

banner-direct.svg

Http Component

GitHub release (latest by date) Tests Static Analysis Total Downloads GitHub

This is the repository for the HTTP Component used in the Sauber PHP Framework.

Installation

You should not need to install this package, as it comes pre-installed with the Sauber PHP Framework, however if you want to use this outside of the framework please use composer:

composer require sauber-php/http

Usage

To use the component, you can instantiate with your own container and add routes:

$router = new Router(
    container: new Container(),
);

$router->middleware(
    middleware: new PSR15Middleware(),
);

$router->get(
    path: '/',
    handler: fn () => ['test' => time()],
);

$router->handle(
    request: Request::capture(),
);

Testing

To run the tests:

./vendor/bin/pest

Static Analysis

To check the static analysis:

./vendor/bin/phpstan analyse

Changelog

Please see the Changelog for more information on what has changed recently.