Skip to content

reactphp-x/middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

reactphp-x-middleware

install

composer require reactphp-x/middleware -vvv

usage

<?php

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

$http = new React\Http\HttpServer(
    new ReactphpX\Middleware\FiberHandler,
    new ReactphpX\Middleware\TrustedProxyMiddleware,
    new ReactphpX\Middleware\CorsMiddleware,
    function (Psr\Http\Message\ServerRequestInterface $request) {
        return React\Http\Message\Response::plaintext(
            "Hello World!\n"
        );
    }
);

$socket = new React\Socket\SocketServer('127.0.0.1:8080');
$http->listen($socket);

or

<?php

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

$http = new React\Http\HttpServer(
    new MiddlewareHandler([
        new ReactphpX\Middleware\FiberHandler,
        new ReactphpX\Middleware\TrustedProxyMiddleware,
        new ReactphpX\Middleware\CorsMiddleware,
        function (Psr\Http\Message\ServerRequestInterface $request) {
            return React\Http\Message\Response::plaintext(
                "Hello World!\n"
            );
        }
    ])
);

$socket = new React\Socket\SocketServer('127.0.0.1:8080');
$http->listen($socket);

middleware

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages