PHP code example of legatus / responder

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

    

legatus / responder example snippets




// This automatically detects installed PSR Message Factories :)
$responder = Legatus\Http\create_responder();

$response = $responder->json([
    'msg' => 'This is a cool json response',
]);

$response = $responder->redirect('/take/me/here');

$response = $responder->html('<h1>Hello World!</h1>');

$response = $responder->blob('/file/location.ext');

$response = $responder->raw();