Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kmvan/php-request
https://github.com/kmvan/php-request
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kmvan/php-request
- Owner: kmvan
- Created: 2022-04-24T07:36:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-04-24T07:49:26.000Z (over 2 years ago)
- Last Synced: 2024-11-14T15:15:12.940Z (about 2 months ago)
- Language: PHP
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
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
```