Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/folour/oxide

Simple and lightweight cURL-based HTTP client for PHP 7.1
https://github.com/folour/oxide

curl http http-client http-requests https oxide php-curl

Last synced: 26 days ago
JSON representation

Simple and lightweight cURL-based HTTP client for PHP 7.1

Awesome Lists containing this project

README

        

# Oxide
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/folour/oxide/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/folour/oxide/?branch=master)
[![downloads](https://poser.pugx.org/folour/oxide/downloads.png)](https://packagist.org/packages/folour/oxide)
[![license](https://poser.pugx.org/folour/oxide/license.png)](https://packagist.org/packages/folour/oxide)

Simple and lightweight cURL-based HTTP client for PHP 7.1

### Requirements
Oxide requires PHP 7.1 and php-curl extension

### Installation
```
composer require folour/oxide
```

### Basic usage
```php
get('https://google.com', ['q' => 'php 7.1']);

//get response body
echo $response->body(); //Or echo $response;
//get response code
echo $response->code();
//get response headers
var_dump($response->headers());
```

### Configure
```php
setHeaders([
'Referer' => 'http://local.dev'
])
->setCookies([
'cookie' => 'value'
])
->setProxy('user:[email protected]:8080');

$response = $oxide->post('http://httpbin.org/post', ['test']);
```

### More HTTP request methods
```php
get('http://httpbin.org/get', ['key' => 'value']);
echo $oxide->head('http://httpbin.org/get', ['key' => 'value']);
echo $oxide->post('http://httpbin.org/post', ['key' => 'value']);
echo $oxide->put('http://httpbin.org/put', ['key' => 'value']);
echo $oxide->delete('http://httpbin.org/delete', ['key' => 'value']);
```