{"id":21823528,"url":"https://github.com/jbzoo/http-client","last_synced_at":"2025-07-09T22:39:51.769Z","repository":{"id":10130444,"uuid":"64576824","full_name":"JBZoo/Http-Client","owner":"JBZoo","description":"Just make HTTP requests in one line and don't care about terrible syntax ;)","archived":false,"fork":false,"pushed_at":"2024-06-22T09:49:34.000Z","size":129,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T16:33:31.395Z","etag":null,"topics":["guzzle","http","http-client","http-requests","jbzoo","rmccue"],"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/JBZoo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-31T04:26:45.000Z","updated_at":"2024-06-22T09:49:37.000Z","dependencies_parsed_at":"2024-11-14T20:48:51.360Z","dependency_job_id":null,"html_url":"https://github.com/JBZoo/Http-Client","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.7272727272727273,"last_synced_commit":"7eeb1db8dcc1ca939a6924276438ddcb19b142f7"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBZoo%2FHttp-Client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBZoo%2FHttp-Client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBZoo%2FHttp-Client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JBZoo%2FHttp-Client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JBZoo","download_url":"https://codeload.github.com/JBZoo/Http-Client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248821696,"owners_count":21166931,"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":["guzzle","http","http-client","http-requests","jbzoo","rmccue"],"created_at":"2024-11-27T17:33:15.403Z","updated_at":"2025-04-14T04:31:16.132Z","avatar_url":"https://github.com/JBZoo.png","language":"PHP","readme":"# JBZoo / Http-Client\n\n[![CI](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Http-Client/actions/workflows/main.yml?query=branch%3Amaster)    [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Http-Client/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Http-Client?branch=master)    [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Http-Client/coverage.svg)](https://shepherd.dev/github/JBZoo/Http-Client)    [![Psalm Level](https://shepherd.dev/github/JBZoo/Http-Client/level.svg)](https://shepherd.dev/github/JBZoo/Http-Client)    [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/http-client/badge)](https://www.codefactor.io/repository/github/jbzoo/http-client/issues)    \n[![Stable Version](https://poser.pugx.org/jbzoo/http-client/version)](https://packagist.org/packages/jbzoo/http-client/)    [![Total Downloads](https://poser.pugx.org/jbzoo/http-client/downloads)](https://packagist.org/packages/jbzoo/http-client/stats)    [![Dependents](https://poser.pugx.org/jbzoo/http-client/dependents)](https://packagist.org/packages/jbzoo/http-client/dependents?order_by=downloads)    [![GitHub License](https://img.shields.io/github/license/jbzoo/http-client)](https://github.com/JBZoo/Http-Client/blob/master/LICENSE)\n\n\n\nJust make HTTP requests in one line and don't care about terrible syntax of GuzzleHttp ;)\n\n\n## Install\n```sh\ncomposer require guzzlehttp/guzzle --no-update # Recommended, but not required\ncomposer require jbzoo/http-client\n```\n\n### Usage\n```php\nuse JBZoo\\HttpClient\\HttpClient;\n\n// Configure client (no options required!)\n$httpClient = new HttpClient([\n    'auth'            =\u003e [          // Simple HTTP auth\n        'http-user-name',\n        'http-password'\n    ],\n    'headers'         =\u003e [          // Your custom headers\n        'X-Custom-Header' =\u003e 42,\n    ],\n    'driver'          =\u003e 'auto',    // (Auto|Guzzle5|Guzzle6|Rmccue)\n    'timeout'         =\u003e 10,        // Wait in seconds\n    'verify'          =\u003e false,     // Check cert for SSL\n    'exceptions'      =\u003e false,     // Show exceptions for statuses 4xx and 5xx\n    'allow_redirects' =\u003e true,      // Show real 3xx-header or result?\n    'max_redirects'   =\u003e 10,        // How much to redirect?\n    'user_agent'      =\u003e \"It's me\", // Custom UserAgent\n]);\n\n// Just request\n$response = $httpClient-\u003erequest('http://my.site.com/', [\n    'key-1' =\u003e 'value-1',\n    'key-2' =\u003e 'value-2'\n], 'post');\n```\n\nMethods of response\n```php\n// Get code\n$code = $response-\u003egetCode();\n$code = $response-\u003ecode;\n$code = $response['code'];\n\n// Get headers\n$headers = $response-\u003egetHeaders();\n$headers = $response-\u003eheaders;\n$headers = $response['headers'];\n$header  = $response-\u003egetHeader('X-Custom-Header-Response');\n$header  = $response-\u003efind('headers.x-custom-header-response', 'default-value', 'trim');\n\n// Get body\n$body = $response-\u003egetBody();\n$body = $response-\u003ebody;\n$body = $response['body'];\n\n// Get body like JSON (see JBZoo/Data lib)\n$json = $response-\u003egetJSON();\n$value = $json-\u003eget('key', 'default', 'trim');\n$value = $json-\u003efind('key.nested', 'default', 'trim');\n```\n\n\n## Asynchronous requests (curl_multi_* for parallels)\n\n```php\nuse JBZoo\\HttpClient\\HttpClient;\n\n$httpClient = new HttpClient();\n\n$results = $httpClient-\u003emultiRequest(array(\n    'request_0' =\u003e 'http://mockbin.org/request',\n    \n    'request_1' =\u003e ['http://mockbin.org/request', [\n        'args' =\u003e ['key' =\u003e 'value']\n    ]],\n    \n    'request_2' =\u003e ['http://mockbin.org/request', [\n        'method' =\u003e 'post',\n        'args'   =\u003e ['key' =\u003e 'value'],\n        'headers'         =\u003e [\n            'X-Custom-Header' =\u003e 42,\n        ],\n        'timeout'         =\u003e 10,\n        'verify'          =\u003e false,\n        'exceptions'      =\u003e false,\n        'allow_redirects' =\u003e true,\n        'max_redirects'   =\u003e 10, \n        'user_agent'      =\u003e 'JBZoo/Http-Client v1.x-dev'\n    ]]\n]);\n\n$results['request_0']-\u003egetBody(); \n$results['request_1']-\u003egetBody(); \n$results['request_2']-\u003egetBody();\n```\n\n## Unit tests and check code style\n```sh\nmake update\nmake test-all\n```\n\n### License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbzoo%2Fhttp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbzoo%2Fhttp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbzoo%2Fhttp-client/lists"}