ryodevz / httpfulwrapper
A Wrapper class for httpful library to make it easy to use.
v2.0.0
2021-08-31 16:43 UTC
Requires
- nategood/httpful: ^0.3.2
This package is auto-updated.
Last update: 2025-04-29 01:11:42 UTC
README
Features
Get request Post request Put request
Installing Httpfulwrapper
The recommended way to install httpfulwrapper is through Composer.
composer require ryodevz/httpfulwrapper
Get
use Ryodevz\HttpfulWrapper\Http; require_once 'vendor/autoload.php'; // Make a request $request = Http::get('https://ytryo.my.id/api/animeku/search?q=naruto'); // Send $response = $request->send(); // Body var_dump($response->body);
Post
use Ryodevz\HttpfulWrapper\Http; use Ryodevz\HttpfulWrapper\Mime; require_once 'vendor/autoload.php'; $response = Http::post('https://example.com/login', [ 'email' => 'zulzariozairi@gmail.com', 'password' => 'secret' ], Mime::FORM)->send(); var_dump($response->body);
Mimes
Mime class | Type |
---|---|
Mime::JSON |
application/json |
Mime::XML |
application/xml |
Mime::XHTML |
application/html+xml |
Mime::FORM |
application/x-www-form-urlencoded |
Mime::UPLOAD |
multipart/form-data |
Mime::PLAIN |
text/plain |
Mime::JS |
text/javascript |
Mime::HTML |
text/html |
Mime::YAML |
application/x-yaml |
Mime::CSV |
text/csv |