PHP code example of fast-forward / http

1. Go to this page and download the library: Download fast-forward/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/ */

    

fast-forward / http example snippets




declare(strict_types=1);

use FastForward\Http\Message\Factory\ResponseFactoryInterface;
use FastForward\Http\ServiceProvider\HttpServiceProvider;
use function FastForward\Container\container;

$container = container(new HttpServiceProvider());

$responseFactory = $container->get(ResponseFactoryInterface::class);

$response = $responseFactory->createResponseFromPayload([
    'message' => 'Hello, Fast Forward HTTP!',
    'ok' => true,
]);

echo $response->getHeaderLine('Content-Type');
// application/json; charset=utf-8