https://github.com/athlon1600/php-curl-client
A very simple curl client - less than 100 lines. Perfect for being a base class.
https://github.com/athlon1600/php-curl-client
curl ext-curl php-curl php-curl-library
Last synced: 7 months ago
JSON representation
A very simple curl client - less than 100 lines. Perfect for being a base class.
- Host: GitHub
- URL: https://github.com/athlon1600/php-curl-client
- Owner: Athlon1600
- License: mit
- Created: 2020-01-10T06:22:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-24T23:24:02.000Z (about 2 years ago)
- Last Synced: 2025-06-07T13:06:27.901Z (8 months ago)
- Topics: curl, ext-curl, php-curl, php-curl-library
- Language: PHP
- Homepage: https://www.proxynova.com/
- Size: 27.3 KB
- Stars: 13
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README



# PHP Curl Client
A very simple curl client - less than 100 lines. Perfect for being a base class.
## Installation
```bash
composer require athlon1600/php-curl-client "^1.0"
```
## Examples
```php
use Curl\Client;
$client = new Client();
// returns standardized Response object no matter what
$response = $client->get('https://stackoverflow.com');
// 200
$status = $response->status;
// HTML content
$body = $response->body;
// curl_error() OR null
$error = $response->error;
// CurlInfo instance
$info = $response->info;
```
**Update:** `$response->info` now returns an object that will have an auto-complete on your IDE.
;
Works with POST requests too:
```php
$client->post('http://httpbin.org/post', ['username' => 'bob', 'password' => 'test']);
```
or you can issue a completely customized request:
```php
$client->request('GET', 'https://www.whatismyip.com/', null, [
'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X)'
], [
CURLOPT_PROXY => '127.0.0.1:8080',
CURLOPT_TIMEOUT => 10
]);
```
## TODO
- make PSR-7 and PSR-18 compatible