Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/sametsahindogan/guzzle-wrapper

A simple wrapper for PHP Guzzle HTTP Client
https://github.com/sametsahindogan/guzzle-wrapper

guzzle guzzlehttp wrapper

Last synced: 4 months ago
JSON representation

A simple wrapper for PHP Guzzle HTTP Client

Awesome Lists containing this project

README

        

# guzzle-wrapper

[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://raw.githubusercontent.com/sametsahindogan/guzzle-wrapper/master/LICENSE)

> This package a simple wrapper for [guzzle/guzzle](https://github.com/guzzle/guzzle).

## Requirements

- [guzzle/guzzle](https://github.com/guzzle/guzzle) **>= 7.0**

## Installation

```bash
composer require sametsahindogan/guzzle-wrapper
```

## Request
**GET**

```php
$api = (new ApiCallBuilder('https://dev.test.com', '/me', ApiCallBuilder::HTTP_GET));

$response = $api->call();
```

**POST**
```php
$api = (new ApiCallBuilder('https://dev.test.com', '/login', ApiCallBuilder::HTTP_POST));

$response = $api->body([ 'Your' => 'Body' ])->call();
```

## Options

Here are a few optional methods to you can add your chain;
```php
->headers([ 'Your' => 'Headers' ])
->bearerToken(' Your Token ')
->basicAuth(' Your Credentials ')
->formParams([ 'Your' => 'Params' ])
->multipart([ 'Your' => 'Multipart' ])
->body([ 'Your' => 'Body' ])
->rawBody('Raw Body')
->queryString(' Your Query String ')
```

## License
MIT © [Samet Sahindogan](https://github.com/sametsahindogan/laravel-jwtredis/blob/master/LICENSE)