{"id":17922713,"url":"https://github.com/overtrue/http","last_synced_at":"2025-04-05T08:07:38.826Z","repository":{"id":27648638,"uuid":"114777211","full_name":"overtrue/http","owner":"overtrue","description":":cactus: A simple http client wrapper.","archived":false,"fork":false,"pushed_at":"2023-02-13T21:58:29.000Z","size":78,"stargazers_count":127,"open_issues_count":2,"forks_count":17,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T07:07:25.406Z","etag":null,"topics":["guzzlehttp","http","http-client","sdk-client","sdk-php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/overtrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["overtrue"]}},"created_at":"2017-12-19T14:49:46.000Z","updated_at":"2025-02-12T12:56:45.000Z","dependencies_parsed_at":"2024-02-01T16:29:52.568Z","dependency_job_id":"c58e223d-7a48-4a19-a3c4-64fffeae717b","html_url":"https://github.com/overtrue/http","commit_stats":{"total_commits":53,"total_committers":9,"mean_commits":5.888888888888889,"dds":"0.28301886792452835","last_synced_commit":"56f434eb84d296b51e59d16a9d07c60a12db2531"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Fhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Fhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Fhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/overtrue%2Fhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/overtrue","download_url":"https://codeload.github.com/overtrue/http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305934,"owners_count":20917208,"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":["guzzlehttp","http","http-client","sdk-client","sdk-php"],"created_at":"2024-10-28T20:40:34.343Z","updated_at":"2025-04-05T08:07:38.808Z","avatar_url":"https://github.com/overtrue.png","language":"PHP","readme":"\u003cp\u003e \n    \u003ch1 align=\"center\"\u003eHttp\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e :cactus: A simple http client wrapper.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/overtrue/http\"\u003e\u003cimg src=\"https://travis-ci.org/overtrue/http.svg?branch=master\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/overtrue/http\"\u003e\u003cimg src=\"https://poser.pugx.org/overtrue/http/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/overtrue/http\"\u003e\u003cimg src=\"https://poser.pugx.org/overtrue/http/v/unstable.svg\" alt=\"Latest Unstable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/overtrue/http/build-status/master\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/overtrue/http/badges/build.png?b=master\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/overtrue/http/?branch=master\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/overtrue/http/badges/quality-score.png?b=master\" alt=\"Scrutinizer Code Quality\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/overtrue/http\"\u003e\u003cimg src=\"https://poser.pugx.org/overtrue/http/downloads\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/overtrue/http\"\u003e\u003cimg src=\"https://poser.pugx.org/overtrue/http/license\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n## Installing\n\n```shell\n$ composer require overtrue/http -vvv\n```\n\n## Usage\n\n```php\n\u003c?php\n\nuse Overtrue\\Http\\Client;\n\n$client = Client::create(); \n\n$response = $client-\u003eget('https://httpbin.org/ip');\n//{\n//    \"ip\": \"1.2.3.4\"\n//}\n```\n\n### Configuration:\n\n```php\n\nuse Overtrue\\Http\\Client;\n\n$config = [\n    'base_uri' =\u003e 'https://www.easyhttp.com/apiV2/',\n    'timeout' =\u003e 3000,\n    'headers' =\u003e [\n        'User-Agent' =\u003e 'MyClient/1.0',\n        'Content-Type' =\u003e 'application/json'\n    ]\n    //...\n];\n\n$client = Client::create($config); // or new Client($config);\n\n//...\n```\n\n### Custom response type\n\n```php\n$config = new Config([\n    'base_uri' =\u003e 'https://www.easyhttp.com/apiV2/',\n    \n    // array(default)/collection/object/raw\n    'response_type' =\u003e 'collection', \n]);\n\n//...\n```\n\n### Logging request and response\n\nInstall monolog:\n\n```bash\n$ composer require monolog/monolog\n```\nAdd logger middleware:\n\n```php\nuse Overtrue\\Http\\Client;\n\n$client = Client::create();\n\n$logger = new \\Monolog\\Logger('my-logger');\n\n$logger-\u003epushHandler(\n    new \\Monolog\\Handler\\RotatingFileHandler('/tmp/my-log.log')\n);\n\n$client-\u003epushMiddleware(\\GuzzleHttp\\Middleware::log(\n                            $logger,\n                            new \\GuzzleHttp\\MessageFormatter(\\GuzzleHttp\\MessageFormatter::DEBUG)\n                        ));\n\n$response = $client-\u003eget('https://httpbin.org/ip');\n```\n\n## :heart: Sponsor me \n\n[![Sponsor me](https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)\n\n如果你喜欢我的项目并想支持它，[点击这里 :heart:](https://github.com/sponsors/overtrue)\n\n\n## Project supported by JetBrains\n\nMany thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.\n\n[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/overtrue)\n\n## PHP 扩展包开发\n\n\u003e 想知道如何从零开始构建 PHP 扩展包？\n\u003e\n\u003e 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/overtrue"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Fhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fovertrue%2Fhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fovertrue%2Fhttp/lists"}