Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kmvan/php-request


https://github.com/kmvan/php-request

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

### COMPATIBILITY

- PHP 8.1 or later

### Install

```shell
composer require kmvan/request
```

### Usage

```php
setBasicUrl('https://example/path/to') // set url
->setQuery([ // set url query
'age' => '19',
])
->addHeader('X-Token', '...') // add header
->setBody([ // set json post data
'name' => 'Jack',
]);
[
'status' => $status, // http status code
'data' => $data, // results json data
'raw' => $raw, // results string data
'info' => $info, // curl_getinfo() returns
] = $req->POST(); // create a POST method request
```