PHP code example of femastudios / http-utils

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

    

femastudios / http-utils example snippets


RequestHeaderUtils::get('Content-Type', 'none'); // Get the header, or default value

ResponseHeaderUtils::put('Content-Type', 'application/json'); // Put the header or throws if they have already been sent
ResponseHeaderUtils::addCsv('Vary', 'Origin'); // Treats the header value as a comma-separated value and adds "Origin"

$uf = UploadedFilesUtils::getUploadedFile('user', 'info', 'avatar'); // Returns an UploadedFile or throws UploadedFileException
$uf->getTmpName(); // Return the file temp filename (e.g. /tmp/php1324.tmp)