| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not enough user ratings | Total: 56 | All time: 10,587 This week: 37 | ||||
| Version | License | PHP version | Categories | |||
| php-http-header-resp 1.0 | GNU General Publi... | 8 | HTTP |
| Description | Author | |
This package can send response headers to process HTTP requests. |
|
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
use PH7\PhpHttpResponseHeader\Header;
// Sends "200 OK" header to the browser
Http::setHeadersByCode(200);
// ...
// Send "201 Created" header
Http::setHeadersByCode(201);
// ...
// Sends "404 Not Found" to the browser
Http::setHeadersByCode(404);
// ...
// Sends "400 Bad Request" header to the browser
Http::setHeadersByCode(400);
// and so on ...
But, the library has many more handy methods such as below:
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);
use PH7\PhpHttpResponseHeader\Header;
// The HTTP server protocol
Http::getProtocol()
use PH7\PhpHttpResponseHeader\Header;
// Send "Content-Type: application/json" header to the browser
Http::setContentType('application/json');
// Send "Content-type: text/xml" to the browser
Http::setContentType('text/xml');
Pierre-Henry Soria. A super passionate and enthusiastic software engineer! ? True cheese ? , coffee, and chocolate lover! ? Reach me at PH7.me ?
?? Are you enjoying it? Offer me a coffee and boost the software development at the same time! ?
[![@phenrysay][twitter-image]](https://twitter.com/phenrysay) [![pH-7][github-image]](https://github.com/pH-7)
PHP HTTP Response is generously distributed under the _MIT_ ? Enjoy!
<!-- GitHub's Markdown reference links --> [twitter-image]: https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white [github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Data | Auxiliary data | |||
| Doc. | Documentation | |||
| / | src |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.