{"id":13395560,"url":"https://github.com/nategood/httpful","last_synced_at":"2025-04-29T18:27:56.470Z","repository":{"id":2154422,"uuid":"3099649","full_name":"nategood/httpful","owner":"nategood","description":"A Chainable, REST Friendly, PHP HTTP Client.  A sane alternative to cURL.","archived":false,"fork":false,"pushed_at":"2024-05-01T12:30:43.000Z","size":512,"stargazers_count":1739,"open_issues_count":87,"forks_count":298,"subscribers_count":80,"default_branch":"master","last_synced_at":"2025-04-17T13:33:41.854Z","etag":null,"topics":[],"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/nategood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2012-01-04T04:31:56.000Z","updated_at":"2025-03-28T09:33:49.000Z","dependencies_parsed_at":"2022-08-09T09:03:28.511Z","dependency_job_id":"ffca10f3-4cd4-4df8-81c9-313723b056d6","html_url":"https://github.com/nategood/httpful","commit_stats":{"total_commits":273,"total_committers":60,"mean_commits":4.55,"dds":0.5201465201465201,"last_synced_commit":"0cded3ea97ba905600de9ceb9ef13f3ab681587c"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nategood%2Fhttpful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nategood%2Fhttpful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nategood%2Fhttpful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nategood%2Fhttpful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nategood","download_url":"https://codeload.github.com/nategood/httpful/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249700259,"owners_count":21312579,"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":[],"created_at":"2024-07-30T18:00:24.070Z","updated_at":"2025-04-29T18:27:56.447Z","avatar_url":"https://github.com/nategood.png","language":"PHP","readme":"# Httpful\n\nHttpful is a simple Http Client library for PHP 8.0+. There is an emphasis of readability, simplicity, and flexibility – basically provide the features and flexibility to get the job done and make those features really easy to use.\n\nFeatures\n\n- Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH and OPTIONS)\n- Custom Headers\n- Automatic \"Smart\" Parsing\n- Automatic Payload Serialization\n- Basic Auth\n- Client Side Certificate Auth\n- Request \"Templates\"\n\n# Sneak Peak\n\nHere's something to whet your appetite. Search the twitter API for tweets containing \"#PHP\". Include a trivial header for the heck of it. Notice that the library automatically interprets the response as JSON (can override this if desired) and parses it as an array of objects.\n\n```php\n\n// Make a request to the GitHub API with a custom\n// header of \"X-Trvial-Header: Just as a demo\".\n$url = \"https://api.github.com/users/nategood\";\n$response = \\Httpful\\Request::get($url)\n    -\u003eexpectsJson()\n    -\u003ewithXTrivialHeader('Just as a demo')\n    -\u003esend();\n\necho \"{$response-\u003ebody-\u003ename} joined GitHub on \" .\n                        date('M jS', strtotime($response-\u003ebody-\u003ecreated_at)) .\"\\n\";\n```\n\n# Installation\n\n## Composer\n\nHttpful is PSR-0 compliant and can be installed using [composer](http://getcomposer.org/). Simply add `nategood/httpful` to your composer.json file. _Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects_.\n\n    {\n        \"require\": {\n            \"nategood/httpful\": \"*\"\n        }\n    }\n\n## Install from Source\n\nBecause Httpful is PSR-0 compliant, you can also just clone the Httpful repository and use a PSR-0 compatible autoloader to load the library, like [Symfony's](http://symfony.com/doc/current/components/class_loader.html). Alternatively you can use the PSR-0 compliant autoloader included with the Httpful (simply `require(\"bootstrap.php\")`).\n\n## Build your Phar\n\nIf you want the build your own [Phar Archive](http://php.net/manual/en/book.phar.php) you can use the `build` script included.\nMake sure that your `php.ini` has the _Off_ or 0 value for the `phar.readonly` setting.\nAlso you need to create an empty `downloads` directory in the project root.\n\n# Contributing\n\nHttpful highly encourages sending in pull requests. When submitting a pull request please:\n\n- All pull requests should target the `dev` branch (not `master`)\n- Make sure your code follows the [coding conventions](http://pear.php.net/manual/en/standards.php)\n- Please use soft tabs (four spaces) instead of hard tabs\n- Make sure you add appropriate test coverage for your changes\n- Run all unit tests in the test directory via `phpunit ./tests`\n- Include commenting where appropriate and add a descriptive pull request message\n\n# Changelog\n\n## 1.0.0\n\n- SECURITY [Make certificate validation the default](https://huntr.com/bounties/8d59c089-92f1-4b73-90f8-54968a70e2fb). This is a potentially breaking change and as a result, bumping major version number in line with semver. Validation can still be skipped but must be explicitly skipped via withoutStrictSSL.\n- REFACTOR [PR #305](https://github.com/nategood/httpful/pull/305) Remove deprecated functionality pre PHP 8.1\n- REFACTOR Partially from [PR #282](https://github.com/nategood/httpful/pull/282) Add CI support for running tests now that Travis is gone.\n\n## 0.3.2\n\n- REFACTOR [PR #276](https://github.com/nategood/httpful/pull/276) Add properly subclassed, more descriptive Exceptions for JSON parse errors\n\n## 0.3.1\n\n- FIX [PR #286](https://github.com/nategood/httpful/pull/286) Fixed header case sensitivity\n\n## 0.3.0\n\n- REFACTOR Dropped support for dead versions of PHP. Updated the PHPUnit tests.\n\n## 0.2.20\n\n- MINOR Move Response building logic into separate function [PR #193](https://github.com/nategood/httpful/pull/193)\n\n## 0.2.19\n\n- FEATURE Before send hook [PR #164](https://github.com/nategood/httpful/pull/164)\n- MINOR More descriptive connection exceptions [PR #166](https://github.com/nategood/httpful/pull/166)\n\n## 0.2.18\n\n- FIX [PR #149](https://github.com/nategood/httpful/pull/149)\n- FIX [PR #150](https://github.com/nategood/httpful/pull/150)\n- FIX [PR #156](https://github.com/nategood/httpful/pull/156)\n\n## 0.2.17\n\n- FEATURE [PR #144](https://github.com/nategood/httpful/pull/144) Adds additional parameter to the Response class to specify additional meta data about the request/response (e.g. number of redirect).\n\n## 0.2.16\n\n- FEATURE Added support for whenError to define a custom callback to be fired upon error. Useful for logging or overriding the default error_log behavior.\n\n## 0.2.15\n\n- FEATURE [I #131](https://github.com/nategood/httpful/pull/131) Support for SOCKS proxy\n\n## 0.2.14\n\n- FEATURE [I #138](https://github.com/nategood/httpful/pull/138) Added alternative option for XML request construction. In the next major release this will likely supplant the older version.\n\n## 0.2.13\n\n- REFACTOR [I #121](https://github.com/nategood/httpful/pull/121) Throw more descriptive exception on curl errors\n- REFACTOR [I #122](https://github.com/nategood/httpful/issues/122) Better proxy scrubbing in Request\n- REFACTOR [I #119](https://github.com/nategood/httpful/issues/119) Better document the mimeType param on Request::body\n- Misc code and test cleanup\n\n## 0.2.12\n\n- REFACTOR [I #123](https://github.com/nategood/httpful/pull/123) Support new curl file upload method\n- FEATURE [I #118](https://github.com/nategood/httpful/pull/118) 5.4 HTTP Test Server\n- FIX [I #109](https://github.com/nategood/httpful/pull/109) Typo\n- FIX [I #103](https://github.com/nategood/httpful/pull/103) Handle also CURLOPT_SSL_VERIFYHOST for strictSsl mode\n\n## 0.2.11\n\n- FIX [I #99](https://github.com/nategood/httpful/pull/99) Prevent hanging on HEAD requests\n\n## 0.2.10\n\n- FIX [I #93](https://github.com/nategood/httpful/pull/86) Fixes edge case where content-length would be set incorrectly\n\n## 0.2.9\n\n- FEATURE [I #89](https://github.com/nategood/httpful/pull/89) multipart/form-data support (a.k.a. file uploads)! Thanks @dtelaroli!\n\n## 0.2.8\n\n- FIX Notice fix for Pull Request 86\n\n## 0.2.7\n\n- FIX [I #86](https://github.com/nategood/httpful/pull/86) Remove Connection Established header when using a proxy\n\n## 0.2.6\n\n- FIX [I #85](https://github.com/nategood/httpful/issues/85) Empty Content Length issue resolved\n\n## 0.2.5\n\n- FEATURE [I #80](https://github.com/nategood/httpful/issues/80) [I #81](https://github.com/nategood/httpful/issues/81) Proxy support added with `useProxy` method.\n\n## 0.2.4\n\n- FEATURE [I #77](https://github.com/nategood/httpful/issues/77) Convenience method for setting a timeout (seconds) `$req-\u003etimeoutIn(10);`\n- FIX [I #75](https://github.com/nategood/httpful/issues/75) [I #78](https://github.com/nategood/httpful/issues/78) Bug with checking if digest auth is being used.\n\n## 0.2.3\n\n- FIX Overriding default Mime Handlers\n- FIX [PR #73](https://github.com/nategood/httpful/pull/73) Parsing http status codes\n\n## 0.2.2\n\n- FEATURE Add support for parsing JSON responses as associative arrays instead of objects\n- FEATURE Better support for setting constructor arguments on Mime Handlers\n\n## 0.2.1\n\n- FEATURE [PR #72](https://github.com/nategood/httpful/pull/72) Allow support for custom Accept header\n\n## 0.2.0\n\n- REFACTOR [PR #49](https://github.com/nategood/httpful/pull/49) Broke headers out into their own class\n- REFACTOR [PR #54](https://github.com/nategood/httpful/pull/54) Added more specific Exceptions\n- FIX [PR #58](https://github.com/nategood/httpful/pull/58) Fixes throwing an error on an empty xml response\n- FEATURE [PR #57](https://github.com/nategood/httpful/pull/57) Adds support for digest authentication\n\n## 0.1.6\n\n- Ability to set the number of max redirects via overloading `followRedirects(int max_redirects)`\n- Standards Compliant fix to `Accepts` header\n- Bug fix for bootstrap process when installed via Composer\n\n## 0.1.5\n\n- Use `DIRECTORY_SEPARATOR` constant [PR #33](https://github.com/nategood/httpful/pull/32)\n- [PR #35](https://github.com/nategood/httpful/pull/35)\n- Added the raw_headers property reference to response.\n- Compose request header and added raw_header to Request object.\n- Fixed response has errors and added more comments for clarity.\n- Fixed header parsing to allow the minimum (status line only) and also cater for the actual CRLF ended headers as per RFC2616.\n- Added the perfect test Accept: header for all Acceptable scenarios see @b78e9e82cd9614fbe137c01bde9439c4e16ca323 for details.\n- Added default User-Agent header\n- `User-Agent: Httpful/0.1.5` + curl version + server software + PHP version\n- To bypass this \"default\" operation simply add a User-Agent to the request headers even a blank User-Agent is sufficient and more than simple enough to produce me thinks.\n- Completed test units for additions.\n- Added phpunit coverage reporting and helped phpunit auto locate the tests a bit easier.\n\n## 0.1.4\n\n- Add support for CSV Handling [PR #32](https://github.com/nategood/httpful/pull/32)\n\n## 0.1.3\n\n- Handle empty responses in JsonParser and XmlParser\n\n## 0.1.2\n\n- Added support for setting XMLHandler configuration options\n- Added examples for overriding XmlHandler and registering a custom parser\n- Removed the httpful.php download (deprecated in favor of httpful.phar)\n\n## 0.1.1\n\n- Bug fix serialization default case and phpunit tests\n\n## 0.1.0\n\n- Added Support for Registering Mime Handlers\n- Created AbstractMimeHandler type that all Mime Handlers must extend\n- Pulled out the parsing/serializing logic from the Request/Response classes into their own MimeHandler classes\n- Added ability to register new mime handlers for mime types\n","funding_links":[],"categories":["HTTP Libraries-","HTTP","超文本传输协议 HTTP","PHP","Client","目录"],"sub_categories":["Laravel  docs","HTTP客户端 HTTP Client"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnategood%2Fhttpful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnategood%2Fhttpful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnategood%2Fhttpful/lists"}