{"id":15025437,"url":"https://github.com/phpgt/curl","last_synced_at":"2025-04-09T20:04:05.959Z","repository":{"id":49161930,"uuid":"72469050","full_name":"phpgt/Curl","owner":"phpgt","description":"Object oriented cURL wrapper.","archived":false,"fork":false,"pushed_at":"2023-05-12T03:58:21.000Z","size":234,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T20:03:56.211Z","etag":null,"topics":["curl","curl-multi","oop-library","php-7","php-curl","php-curl-async","php-interface","phpgt","wrapper"],"latest_commit_sha":null,"homepage":"https://php.gt/curl","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/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["phpgt"]}},"created_at":"2016-10-31T19:05:00.000Z","updated_at":"2022-07-01T10:27:42.000Z","dependencies_parsed_at":"2025-02-15T19:31:21.302Z","dependency_job_id":"10e425bb-28ec-4c81-b6fc-6fb710aa5d40","html_url":"https://github.com/phpgt/Curl","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/Curl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103865,"owners_count":21048245,"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":["curl","curl-multi","oop-library","php-7","php-curl","php-curl-async","php-interface","phpgt","wrapper"],"created_at":"2024-09-24T20:02:20.328Z","updated_at":"2025-04-09T20:04:05.929Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","readme":"cURL object wrapper.\n====================\n\nThis library wraps PHP's native cURL extension functions with objects, for better code readability and testability.\n\nWhy? We wanted to lay an object oriented foundation for [PHP.Gt/Fetch](https://php.gt/fetch), our PHP implementation of the web's fetch API that uses cURL to create asynchronous HTTP calls with promises.\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/Curl/actions\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://badge.status.php.gt/curl-build.svg\" alt=\"Build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/Curl\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://badge.status.php.gt/curl-quality.svg\" alt=\"Code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/PhpGt/Curl\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://badge.status.php.gt/curl-coverage.svg\" alt=\"Code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/PhpGt/Curl\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://badge.status.php.gt/curl-version.svg\" alt=\"Current version\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.php.gt/curl\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://badge.status.php.gt/curl-docs.svg\" alt=\"PHP.Gt/Curl documentation\" /\u003e\n\u003c/a\u003e\n\nExample usage: Get a JSON object from a remote source\n\nWhen working with HTTP calls, it is extremely common to work with JSON. This library removes the need of a lot of boilerplate code by buffering the output of `exec()` calls for easy retrieval later with `output()` or `outputJson()`.\n\nExample using PHP.Gt/Curl:\n--------------------------\n\n```php\n$curl = new Curl(\"https://catfact.ninja/fact\");\n$curl-\u003eexec();\n$json = $curl-\u003eoutputJson();\necho \"Here's a cat fact: {$json-\u003egetString(\"fact\")}\";\necho PHP_EOL;\necho \"The fact's length is {$json-\u003egetInt(\"length\")} characters.\";\necho PHP_EOL;\n```\n\nSame example using PHP's native `curl_*` functions:\n---------------------------------------------------\n\n```php\n// Using native functionality to achieve the same:\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://catfact.ninja/fact\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n$result = curl_exec($ch);\nif(false === $result) {\n\tdie(\"CURL error: \" . curl_error($ch));\n}\n$json = json_decode($result);\nif(is_null($json)) {\n\tdie(\"JSON decoding error: \" . json_last_error_msg());\n}\n\n// Note: No type checks are made on the `fact` and `length` properties here.\necho \"Here's a cat fact: {$json-\u003efact}\";\necho PHP_EOL;\necho \"The fact's length is {$json-\u003elength} characters.\";\necho PHP_EOL;\n```\n","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Fcurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcurl/lists"}