PHP Classes

PHP HTTP Header Response: Send response headers to process HTTP requests

Recommend this page to a friend!
  Info   View files Documentation   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-06-09 (11 months ago) RSS 2.0 feedNot enough user ratingsTotal: 55 All time: 10,564 This week: 673Up
Version License PHP version Categories
php-http-header-resp 1.0GNU General Publi...8HTTP


This package can send response headers to process HTTP requests.

It provides functions to generate and send HTTP response headers based on the HTTP status codes passed as parameters.

The package can also get the current request protocol to determine if it is HTTP or HTTPS.

It can also send the content type of the HTTP response.

Picture of Pierre-Henry Soria
  Performance   Level  
Name: Pierre-Henry Soria <contact>
Classes: 46 packages by
Country: United Kingdom
Age: 33
All time rank: 37716 in United Kingdom
Week rank: 17 Up1 in United Kingdom Up
Innovation award
Innovation award
Nominee: 17x

Winner: 3x


PHP HTTP Response

Send easily HTTP header responses to the browser.


* PHP v8.0 or higher ?


The simplest way to add this library to your project, is with Composer

composer require ph-7/php-http-response-header

? Usage - Examples

Send Header By HTTP Code

use PH7\PhpHttpResponseHeader\Header;

// Sends "200 OK" header to the browser

// ...

// Send "201 Created" header

// ...

// Sends "404 Not Found" to the browser

// ...

// Sends "400 Bad Request" header to the browser

// and so on ...

But, the library has many more handy methods such as below:

Maintenance Code

use PH7\PhpHttpResponseHeader\Header;

// Send 503, Service Temporarily Unavailable to the browser mentioning that you are doing a maintenance (good practice!)
Http::setMaintenanceCode($maintenanceTimeSeconds: 360);

Get HTTP Protocol

use PH7\PhpHttpResponseHeader\Header;

//  The HTTP server protocol

Set Content Type

use PH7\PhpHttpResponseHeader\Header;

// Send "Content-Type: application/json" header to the browser

// Send "Content-type: text/xml" to the browser

??? Who baked this?

Pierre-Henry Soria

Pierre-Henry Soria. A super passionate and enthusiastic software engineer! ? True cheese ? , coffee, and chocolate lover! ? Reach me at ?

?? Are you enjoying it? Offer me a coffee and boost the software development at the same time! ?

[![@phenrysay][twitter-image]]( [![pH-7][github-image]](

?? License

PHP HTTP Response is generously distributed under the _MIT_ ? Enjoy!

<!-- GitHub's Markdown reference links --> [twitter-image]: [github-image]:

  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (3 files)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file ci-test.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file Exception.php Class Class source
  Plain text file Http.php Class Class source
  Plain text file Server.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file HttpTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,564
This week:673Up