Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/folour/oxide
- Owner: folour
- License: gpl-3.0
- Created: 2017-05-27T15:25:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-21T13:45:10.000Z (over 7 years ago)
- Last Synced: 2024-04-21T01:09:14.890Z (9 months ago)
- Topics: curl, http, http-client, http-requests, https, oxide, php-curl
- Language: PHP
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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']);
```