{"id":19746048,"url":"https://github.com/kwhat/requestful","last_synced_at":"2025-04-30T08:30:39.989Z","repository":{"id":57010190,"uuid":"228692413","full_name":"kwhat/requestful","owner":"kwhat","description":"A simple PSR compatible HTTP client library","archived":false,"fork":false,"pushed_at":"2022-06-04T18:30:56.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-05T13:20:51.224Z","etag":null,"topics":["async","asyncronous","curl","php7","psr-17","psr-18","psr-7"],"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/kwhat.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":"2019-12-17T20:03:14.000Z","updated_at":"2024-04-05T13:20:51.225Z","dependencies_parsed_at":"2022-08-21T15:10:18.427Z","dependency_job_id":null,"html_url":"https://github.com/kwhat/requestful","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwhat%2Frequestful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwhat%2Frequestful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwhat%2Frequestful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwhat%2Frequestful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwhat","download_url":"https://codeload.github.com/kwhat/requestful/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224202839,"owners_count":17272807,"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":["async","asyncronous","curl","php7","psr-17","psr-18","psr-7"],"created_at":"2024-11-12T02:13:18.773Z","updated_at":"2024-11-12T02:13:19.482Z","avatar_url":"https://github.com/kwhat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/kwhat/requestful/version)](https://packagist.org/packages/kwhat/requestful)\n[![Latest Unstable Version](https://poser.pugx.org/kwhat/requestful/v/unstable)](//packagist.org/packages/kwhat/requestful)\n[![Build Status](https://github.com/kwhat/requestful/workflows/continuous-integration/badge.svg)](https://github.com/kwhat/requestful/actions?query=workflow%3Acontinuous-integration)\n[![Total Downloads](https://poser.pugx.org/kwhat/requestful/downloads)](https://packagist.org/packages/kwhat/requestful)\n[![License](https://poser.pugx.org/kwhat/requestful/license)](https://packagist.org/packages/kwhat/requestful)\n[![composer.lock available](https://poser.pugx.org/kwhat/requestful/composerlock)](https://packagist.org/packages/kwhat/requestful)\n\n# Requestful: A simple PSR compatible HTTP client library\n\nThe goal of this library is to provide a short, simple and easy to understand alternative to \n[Guzzle](https://github.com/guzzle/guzzle).\n\n- Uses the latest [PSR](https://www.php-fig.org/psr/) standards and recommendations\n    - [PSR-7](https://www.php-fig.org/psr/psr-7/) HTTP Message Interfaces\n    - [PSR-17](https://www.php-fig.org/psr/psr-17/) HTTP Factories\n    - [PSR-18](https://www.php-fig.org/psr/psr-17/) HTTP Client\n- Supports both synchronous and asynchronous HTTP requests \n- [A+ Promises](https://promisesaplus.com/) with a Guzzle compatible interface\n- Modern PHP 7 support\n- Hard ext-curl requirement\n\n## Installation\n\n```bash\ncomposer require kwhat/requestful\n```\n\n## Usage\n\nYou will need a PSR-17 implantation to use this library.  Personally I enjoy working with \n[nyholm/psr7](https://github.com/Nyholm/psr7), but any library that provides psr/http-factory will be sufficient.\n\n```php\n$factory = new Nyholm\\Psr7\\Factory\\Psr17Factory();\n$client = new Requestful\\Http\\Client($factory);\n$request = $factory-\u003ecreateRequest(\n    \"GET\", \n    \"https://samples.openweathermap.org/data/2.5/weather?q=Los%20Angeles\"\n);\n\n// Send a synchronous request\n$response = $client-\u003esendRequest($request);\n\nvar_dump(\n    $response-\u003egetStatusCode(), // int(200)\n    $response-\u003egetHeaderLine(\"content-type\"), // string(30) \"application/json; charset=utf8\"\n    $response-\u003egetBody() // string(459) \"{\"coord\": {...}, \"weather\": {...}, ...}\"\n);\n\n// Send an asynchronous request\n$promise = $client-\u003esendRequestAsync($request)\n    -\u003ethen(function (Psr\\Http\\Message\\ResponseInterface $response): string {\n        return \"Success: {$response-\u003egetStatusCode()}\";\n    });\n\nvar_dump($promise-\u003ewait()); // string(12) \"Success: 200\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwhat%2Frequestful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwhat%2Frequestful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwhat%2Frequestful/lists"}