drhino/request

PSR request handler

0.0.3 2023-06-29 07:00 UTC

This package is auto-updated.

Last update: 2024-11-29 10:08:32 UTC


README

Route request handler.

composer require drhino/request
<?php declare(strict_types=1);

# require __DIR__ . '/vendor/autoload.php';

$routes = function(\FastRoute\RouteCollector $r) {

    $r->get('/{name}', drhino\Request\Example\IndexHandler::class);

    $r->post('/', drhino\Request\Example\PostHandler::class);

};

// Default headers, unless otherwise specified in the response.
$headers = [
    'Access-Control-Allow-Origin' => '*',
    'Cache-Control' => 'no-store'
];

new \drhino\Request\Handler($routes, $headers);