lukaszterg / restc
Simple and fast rest client
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/lukaszterg/restc
Requires
- php: >=7.0.0
- ext-curl: *
- ext-json: *
Requires (Dev)
- php: >=7.0.0
This package is auto-updated.
Last update: 2025-12-30 13:10:10 UTC
README
https://github.com/lukaszterg/restc (c) 2024 lukaszjarosinski@gmail.com
Installation
$ php composer.phar require lukaszterg/restc
Basic Usage
$client = new Client(); $headers = array("Content-Type" => "application/x-www-form-urlencoded"); //example headers, unnecessary $parameters = array('name'=>'Name','gender'=>'male','email'=>'email@email.com','status'=>'active'); //example parameters, unnecessary $client->get('http://www.boredapi.com/api/activity'); //url echo "<pre>"; var_dump($client->returnResponse()); echo "</pre>";
Configurable Options
headers - An associative array of HTTP headers and values to be included in every request.
parameters - An associative array of URL or body parameters to be included in every request.
user_agent - User agent string to use in requests.
username - Username to use for HTTP basic authentication. Requires password.
password - Password to use for HTTP basic authentication. Requires username.
Supported methods
The tool supports methods GET, POST, PATCH, DELETE. Examples:
$client->get('http://www.boredapi.com/api/activity'); $client->post('https://gorest.co.in/public/v1/users',array('name'=>'Name','gender'=>'male','email'=>'email@email.com','status'=>'active'),array('Authorization'=>'Bearer '.$token));