ryodevz / httpwrapper
Httpwrapper is a PHP HTTP client library.
v1.0.0
2022-06-15 14:37 UTC
Requires
- php: ^7.2.5 || ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.4
This package is not auto-updated.
Last update: 2024-11-15 01:08:14 UTC
README
Httpwrapper is a PHP HTTP client library.
Installation
composer require ryodevz/httpwrapper
GET Request
<?php use Ryodevz\Httpwrapper\Http; $response = Http::get('https://example.com', ['user_id' => 1, 'category_id' => 1]) ->send() // Send Request ->body(); // Get Response
POST Request
<?php use Ryodevz\Httpwrapper\Http; $response = Http::post('https://example.com', $data) ->send() // Send Request ->body(); // Get Response
PUT Request
<?php use Ryodevz\Httpwrapper\Http; $response = Http::put('https://example.com', $data) ->send() // Send Request ->body(); // Get Response
PATCH Request
<?php use Ryodevz\Httpwrapper\Http; $response = Http::patch('https://example.com', $data) ->send() // Send Request ->body(); // Get Response
DELETE Request
<?php use Ryodevz\Httpwrapper\Http; $response = Http::delete('https://example.com', $data) ->send() // Send Request ->body(); // Get Response
With Headers
<?php use Ryodevz\Httpwrapper\Http; $headers = [ 'Content-Type' => 'application/json', 'Accept' => 'application/json' ]; Http::withHeaders($headers)->post('https://example.com', $data)