borschphp/application

Borsch Framework application.

0.7.2 2022-02-28 09:26 UTC

This package is auto-updated.

Last update: 2022-04-28 10:04:16 UTC


README

Borsch Framework application wrapper.

This package is part of the Borsch Framework.

Installation

Via composer :

composer require borschphp/application

Usage

$server_request = (new ServerRequestFactory())->createServerRequest(
    'GET',
    'https://tests.com/to/get'
);

$container = new Container();
$container->set(PipePathMiddleware::class);
$container->set(RouteMiddleware::class);
$container->set(DispatchMiddleware::class);
$container->set(NotFoundHandlerMiddleware::class);
$container->set(TestHandler::class);
$container->set(FastRouteRouter::class);
$container->set(RouterInterface::class, FastRouteRouter::class)->cache(true);

$app = new App(
    new RequestHandler(),
    $container->get(RouterInterface::class),
    $container
);

$app->pipe(RouteMiddleware::class);
$app->pipe(DispatchMiddleware::class);
$app->pipe(NotFoundHandlerMiddleware::class);

$app->get('/to/get', TestHandler::class);

$app->run(ServerRequestFactory::fromGlobals());

License

The package is licensed under the MIT license. See License File for more information.