{"id":15136863,"url":"https://github.com/carstenwindler/http-helper","last_synced_at":"2026-03-04T16:31:35.164Z","repository":{"id":62499901,"uuid":"104448735","full_name":"carstenwindler/http-helper","owner":"carstenwindler","description":"A tiny collection of helper functions which might be useful for your everday work with http requests","archived":false,"fork":false,"pushed_at":"2025-03-30T14:46:36.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-06T04:06:20.564Z","etag":null,"topics":["curl","diactoros","helper","http","httpfoundation","laminas","psr-7","request","response","symfony"],"latest_commit_sha":null,"homepage":null,"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/carstenwindler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-22T08:07:01.000Z","updated_at":"2025-03-30T14:44:42.000Z","dependencies_parsed_at":"2022-11-02T12:01:26.428Z","dependency_job_id":null,"html_url":"https://github.com/carstenwindler/http-helper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/carstenwindler/http-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carstenwindler%2Fhttp-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carstenwindler%2Fhttp-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carstenwindler%2Fhttp-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carstenwindler%2Fhttp-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carstenwindler","download_url":"https://codeload.github.com/carstenwindler/http-helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carstenwindler%2Fhttp-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30086451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["curl","diactoros","helper","http","httpfoundation","laminas","psr-7","request","response","symfony"],"created_at":"2024-09-26T06:41:38.638Z","updated_at":"2026-03-04T16:31:35.129Z","avatar_url":"https://github.com/carstenwindler.png","language":"PHP","readme":"# Http Helper \n\n[![Latest Stable Version](https://poser.pugx.org/carstenwindler/http-helper/v/stable)](https://packagist.org/packages/carstenwindler/http-helper)\n[![Minimum PHP Version](https://img.shields.io/packagist/php-v/carstenwindler/http-helper.svg)](https://php.net/)\n[![License](https://poser.pugx.org/carstenwindler/http-helper/license)](https://packagist.org/packages/carstenwindler/http-helper)\n[![Total Downloads](https://poser.pugx.org/carstenwindler/http-helper/downloads)](https://packagist.org/packages/carstenwindler/http-helper)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/carstenwindler/http-helper/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/carstenwindler/http-helper/?branch=master)\n\nA collection of helper functions for your everyday work with http requests and responses.\n\nSupports \n* PSR-7 (`Psr\\Http\\Message\\RequestInterface`, `Psr\\Http\\Message\\ResponseInterface`)\n* Symfony HttpFoundation (`Symfony\\Component\\HttpFoundation\\Request`, `Symfony\\Component\\HttpFoundation\\Response`) \n\nThe main idea of these functions was to provide quick access to the http information during development (e.g. via the debugger console), that's why the functions are not namespaced. *It's not meant to be used in your actual code*! Srsly, it's not.\n\n# Example\n\nHere are some http-helper functions in action:\n\n![Basic usage](http://media.carstenwindler.de/packages/http-helper/http-helper-example-basic-usage.gif \"Basic usage of http-helper\")\n\n# Installation\n\n`composer require --dev carstenwindler/http-helper`\n\n(I suggest to only add these functions as `require-dev`).\n\nThe functions are registered using the composer autoload feature, so there is nothing more for you to do.\n\n# Helper functions\n\n## Request\n\nBoth `Psr\\Http\\Message\\RequestInterface` and `Symfony\\Component\\HttpFoundation\\Request` are supported by the following functions. \n\n### request_to_string()\n\nSerializes the request object in plain HTTP format according to [RFC 7230](https://tools.ietf.org/html/rfc7230#page-19).\n\n### request_to_file()\n\nJust like _request_to_string()_, but the request string will be stored in a file called `request.http` in your DOCUMENT_ROOT.\n\nThis way you can e.g. easily execute the request using PhpStorms cool [Editor-based Rest Client](https://blog.jetbrains.com/phpstorm/2017/09/editor-based-rest-client/).\n\nIf the file already exists and is not empty, the request will be appended.\n\n### request_to_curl()\n\nReturns the request object as cURL command, so it can be used e.g. on console or import it in Postman easily.\n\n## Response\n\nBoth `Psr\\Http\\Message\\ResponseInterface` and `Symfony\\Component\\HttpFoundation\\Response` are supported by the following functions. \n\n### response_to_string()\n\nSerializes the response object in plain HTTP format according to [RFC 7230](https://tools.ietf.org/html/rfc7230#page-19).\n\n### response_to_file()\n\nJust like `response_to_string()`, but the response string will be stored in a file called `response.http` in your DOCUMENT_ROOT.\n\n# File usage\n\nThe following example shows you how to store requests and responses in files easily. \n\n![Advanced usage example](http://media.carstenwindler.de/packages/http-helper/http-helper-example-file-usage.gif \"Basic usage of http-helper\")\n\nBut why would you do that? Here, PhpStorm comes into play. It now comes equipped with the cool [Editor-based Rest Client](https://blog.jetbrains.com/phpstorm/2017/09/editor-based-rest-client/) (think of it like a very simple Postman without all the fancy gui).\n\n*http-helper* uses the suffix `.http`, which is recognised by PhpStorm, so you will immediately have the possibility to modify and rerun the request in that file. I quite like the idea, since you could add it to your code base, so your fellow devs would have immediate access.\n\n# Credits\n\nThe serialization of the PSR-7 requests and responses are done using [Laminas Diactoros](https://github.com/laminas/laminas-diactoros). Weird name, great library!\n\nFor Symfony, the build-in serializers are used. Nice.\n\n# Todo\n\n* make storage path of `*_to_file()` configurable\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarstenwindler%2Fhttp-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarstenwindler%2Fhttp-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarstenwindler%2Fhttp-helper/lists"}