{"id":21771134,"url":"https://github.com/initphp/http","last_synced_at":"2025-08-15T15:17:33.013Z","repository":{"id":56991538,"uuid":"470089620","full_name":"InitPHP/HTTP","owner":"InitPHP","description":"This library provides HTTP Message and HTTP Factory solution following PSR-7 and PSR-17 standards. It also includes an Emitter class for the PSR-7.","archived":false,"fork":false,"pushed_at":"2023-08-26T14:45:09.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T13:55:46.897Z","etag":null,"topics":["emitter","http-emitter","http-message","php","php-http","php7","psr-17","psr-7","psr7-handler","psr7-http","psr7-request","psr7-response"],"latest_commit_sha":null,"homepage":"","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/InitPHP.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":"2022-03-15T09:33:26.000Z","updated_at":"2022-04-04T08:18:55.000Z","dependencies_parsed_at":"2022-08-21T12:20:48.166Z","dependency_job_id":null,"html_url":"https://github.com/InitPHP/HTTP","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/InitPHP/HTTP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FHTTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FHTTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FHTTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FHTTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InitPHP","download_url":"https://codeload.github.com/InitPHP/HTTP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitPHP%2FHTTP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270586479,"owners_count":24611317,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["emitter","http-emitter","http-message","php","php-http","php7","psr-17","psr-7","psr7-handler","psr7-http","psr7-request","psr7-response"],"created_at":"2024-11-26T14:15:10.885Z","updated_at":"2025-08-15T15:17:32.751Z","avatar_url":"https://github.com/InitPHP.png","language":"PHP","readme":"# InitPHP HTTP\n\nThis library provides HTTP Message and HTTP Factory solution following PSR-7 and PSR-17 standards. It also includes an Emitter class for the PSR-7.\n\n[![Latest Stable Version](http://poser.pugx.org/initphp/http/v)](https://packagist.org/packages/initphp/http) [![Total Downloads](http://poser.pugx.org/initphp/http/downloads)](https://packagist.org/packages/initphp/http) [![Latest Unstable Version](http://poser.pugx.org/initphp/http/v/unstable)](https://packagist.org/packages/initphp/http) [![License](http://poser.pugx.org/initphp/http/license)](https://packagist.org/packages/initphp/http) [![PHP Version Require](http://poser.pugx.org/initphp/http/require/php)](https://packagist.org/packages/initphp/http)\n\n## Requirements\n\n- PHP 7.4 or higher\n- PSR-7 HTTP Message Interfaces\n- PSR-17 HTTP Factories Interfaces\n- PSR-18 HTTP Client Interfaces\n\n## Installation\n\n```\ncomposer require initphp/http\n```\n\n## Usage\n\nIt adheres to the PSR-7, PSR-17, PSR-18 standards and strictly implements these interfaces to a large extent.\n\n### PSR-7 Emitter Usage\n\n```php\nuse \\InitPHP\\HTTP\\Message\\{Response, Stream};\nuse \\InitPHP\\HTTP\\Emitter\\Emitter;\n\n\n$response = new Response(200, [], new Stream('Hello World', null), '1.1');\n\n$emitter = new Emitter();\n$emitter-\u003eemit($response);\n```\n\nor \n\n```php\nuse \\InitPHP\\HTTP\\Facade\\Factory;\nuse \\InitPHP\\HTTP\\Facade\\Emitter;\n\n$response = Factory::createResponse(200);\n$response-\u003egetBody()-\u003ewrite('Hello World');\n\nEmitter::emit($response);\n```\n\n### PSR-17 Factory Usage\n\n```php\nuse \\InitPHP\\HTTP\\Factory\\Factory;\n\n$httpFactory = new Factory();\n\n/** @var \\Psr\\Http\\Message\\RequestInterface $request */\n$request = $httpFactory-\u003ecreateRequest('GET', 'http://example.com');\n\n// ...\n```\n\nor\n\n```php\nuse InitPHP\\HTTP\\Facade\\Factory;\n\n/** @var \\Psr\\Http\\Message\\RequestInterface $request */\n$request = Factory::createRequest('GET', 'http://example.com');\n```\n\n### PSR-18 Client Usage\n\n```php\nuse \\InitPHP\\HTTP\\Message\\Request;\nuse \\InitPHP\\HTTP\\Client\\Client;\n\n$request = new Request('GET', 'http://example.com');\n\n$client = new Client();\n\n/** @var \\Psr\\Http\\Message\\ResponseInterface $response */\n$response = $client-\u003esendRequest($request);\n```\n\nor\n\n```php\nuse \\InitPHP\\HTTP\\Facade\\Factory;\nuse \\InitPHP\\HTTP\\Facade\\Client;\n\n$request = Factory::createRequest('GET', 'http://example.com');\n\n/** @var \\Psr\\Http\\Message\\ResponseInterface $response */\n$response = Client::sendRequest($request);\n```\n\n\n\n#### A Small Difference For PSR-7 Stream\n\nIf you are working with small content; The PSR-7 Stream interface may be cumbersome for you. This is because the PSR-7 stream interface writes the content \"`php://temp`\" or \"`php://memory`\". By default this library will also overwrite `php://temp` with your content. To change this behavior, this must be declared as the second parameter to the constructor method when creating the Stream object.\n\n```php\nuse \\InitPHP\\HTTP\\Stream;\n\n/**\n * This content is kept in memory as a variable.\n */\n$variableStream = new Stream('String Content', null);\n\n/**\n * Content; \"php://memory\" is overwritten.\n */\n$memoryStream = new Stream('Content', 'php://memory');\n\n/**\n * Content; \"php://temp\" is overwritten.\n */\n$tempStream = new Stream('Content', 'php://temp');\n// or new Stream('Content');\n```\n\n## Credits\n\n- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) \u003c\u003cinfo@muhammetsafak.com.tr\u003e\u003e\n\n## License\n\nCopyright \u0026copy; 2022 [MIT License](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finitphp%2Fhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitphp%2Fhttp/lists"}