PHP code example of icanboogie / http

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

    

icanboogie / http example snippets




namespace ICanBoogie\HTTP;

// The request is usually created from the $_SERVER super global.
$request = Request::from_server();

/* @var ResponderProvider $responder_provider */

// The Responder Provider matches a request with a Responder
$responder = $responder_provider->responder_for_request($request);

// The Responder responds to the request with a Response, it might also throw an exception.
$response = $responder->respond($request);

// The response is sent to the client.
(new SimpleResponseSender())->send($response->finalize($request));
# or
$response($request); // request is only necessary in file responses