{"id":16673049,"url":"https://github.com/ph-7/php-http-header-response","last_synced_at":"2025-10-16T16:03:14.470Z","repository":{"id":173821208,"uuid":"651345283","full_name":"pH-7/php-http-header-response","owner":"pH-7","description":"A simple package to send HTTP header responses ✨","archived":false,"fork":false,"pushed_at":"2025-02-28T09:47:39.000Z","size":485,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T20:04:58.758Z","etag":null,"topics":["header","http","http-codes","http-headers","php","php-header-response","php-headers","php-http-headers"],"latest_commit_sha":null,"homepage":"https://youtu.be/Q4djsRczxgo","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pH-7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-09T03:32:10.000Z","updated_at":"2025-02-28T09:47:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd8d85ce-7f54-4307-8863-ff2fb3456ba8","html_url":"https://github.com/pH-7/php-http-header-response","commit_stats":null,"previous_names":["ph-7/php-http-header-response"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2Fphp-http-header-response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2Fphp-http-header-response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2Fphp-http-header-response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2Fphp-http-header-response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pH-7","download_url":"https://codeload.github.com/pH-7/php-http-header-response/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103868,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["header","http","http-codes","http-headers","php","php-header-response","php-headers","php-http-headers"],"created_at":"2024-10-12T12:24:19.217Z","updated_at":"2025-10-16T16:03:14.461Z","avatar_url":"https://github.com/pH-7.png","language":"PHP","readme":"# PHP HTTP Response Headers\n\n**Simple PHP package to safely send the right HTTP header responses to the browser 🐘**\n\n- [⚙️ Requirement](#%EF%B8%8F-requirement)\n- [📦 Installation](#-installation)\n- [🪄 Examples](#-usage---examples)\n- [👨‍🍳 Who is the baker?](#-who-baked-this)\n- [🎥 Me building this package](#-me-building-this-package)\n- [⚖️ License](#%EF%B8%8F-license)\n\n## ⚙️ Requirement\n * [PHP v8.0](https://www.php.net/releases/8.0/en.php) or higher 🚀\n\n\n## 📦 Installation\n\nThe simplest way to add this library to your project, is with [Composer](https://getcomposer.org).\n\n```console\ncomposer require ph-7/php-http-response-header\n```\n\n## 🪄 Usage - Examples\n\n### Send Header By HTTP Code\n```php\nuse PH7\\PhpHttpResponseHeader\\Header;\n\n// Sends \"200 OK\" header to the browser\nHttp::setHeadersByCode(200);\n\n// ...\n\n// Send \"201 Created\" header\nHttp::setHeadersByCode(201);\n\n// ...\n\n// Sends \"404 Not Found\" to the browser\nHttp::setHeadersByCode(404);\n\n// ...\n\n// Sends \"400 Bad Request\" header to the browser\nHttp::setHeadersByCode(400);\n\n\n// and so on ...\n```\n\n**But, the library has many more handy methods such as below:**\n\n### Maintenance Code\n```php\nuse PH7\\PhpHttpResponseHeader\\Header;\n\n// Send 503, Service Temporarily Unavailable to the browser mentioning that you are doing a maintenance (good practice!)\nHttp::setMaintenanceCode($maintenanceTimeSeconds: 360);\n```\n\n### Get HTTP Protocol\n\n```php\nuse PH7\\PhpHttpResponseHeader\\Header;\n\n//  The HTTP server protocol\nHttp::getProtocol()\n```\n\n### Set Content Type\n```php\nuse PH7\\PhpHttpResponseHeader\\Header;\n\n// Send \"Content-Type: application/json\" header to the browser\nHttp::setContentType('application/json');\n\n// Send \"Content-type: text/xml\" to the browser\nHttp::setContentType('text/xml');\n```\n\n\n## 🧑‍🍳 Who baked this?\n\n[![Pierre-Henry Soria](https://s.gravatar.com/avatar/a210fe61253c43c869d71eaed0e90149?s=200)](https://PH7.me 'Pierre-Henry Soria personal website')\n\n**Pierre-Henry Soria**. A super passionate and enthusiastic software engineer! 🚀 True cheese 🧀 , coffee, and chocolate lover! 😋 Reach me at [PH7.me](https://PH7.me) 💫\n\n☕️ Are you enjoying it? **[Offer me a coffee](https://ko-fi.com/phenry)** (my favorite coffee to start the day is almond flat white 😋)\n\n[![@phenrysay][twitter-icon]](https://x.com/phenrysay) [![YouTube Tech Videos][youtube-icon]](https://www.youtube.com/@pH7Programming \"My YouTube Tech Channel\") [![pH-7][github-icon]](https://github.com/pH-7)\n\n\n## 🎥 Me building this package\n\n[![Watch the video][video-thumbnail]](https://youtu.be/Q4djsRczxgo)\n\n👉 **[Click here to watch on YouTube](https://youtu.be/Q4djsRczxgo)**, me building this package from A to Z.\n\n---\n\n![PHP HTTP Response Headers - Send Header By HTTP Code](media/php-http-header-response.png)\n\n\n## ⚖️ License\n\n**PHP HTTP Response** is generously distributed under the _[MIT](https://opensource.org/licenses/MIT)_ 🎉 Enjoy!\n\n\n\u003c!-- GitHub's Markdown reference links --\u003e\n[twitter-icon]: https://img.shields.io/badge/x-000000?style=for-the-badge\u0026logo=x\n[github-icon]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge\u0026logo=github\u0026logoColor=white\n[youtube-icon]: https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge\u0026logo=youtube\u0026logoColor=white\n[video-thumbnail]: https://i1.ytimg.com/vi/Q4djsRczxgo/maxresdefault.jpg\n\n","funding_links":["https://ko-fi.com/phenry"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph-7%2Fphp-http-header-response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fph-7%2Fphp-http-header-response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph-7%2Fphp-http-header-response/lists"}