PHP code example of conorsmith / fileresponse

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

    

conorsmith / fileresponse example snippets


use ConorSmith\FileResponse\TextFileResponse;

$response = new TextFileResponse('example.txt', 'This is the text file\'s contents');
$response->send();

use ConorSmith\FileResponse\FileResponse;

class NsfwJpegFileResponse extends FileResponse
{
    public function __construct($filename, $content)
    {
        parent::__construct($filename, $content, array(
            'Content-Type' => 'image/jpeg',
            'X-Content-NSFW' => true,
        ));
    }
}