PHP code example of ausus / api-http

1. Go to this page and download the library: Download ausus/api-http library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ausus / api-http example snippets


use Ausus\Api\Http\{Router, Emitter};
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7Server\ServerRequestCreator;

$factory = new Psr17Factory();
$creator = new ServerRequestCreator($factory, $factory, $factory, $factory);
$router  = new Router($graph, $driver, $auditSink, $factory, $factory);

Emitter::emit($router->handle($creator->fromGlobals()));