New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

nnjeim/fetch

Laravel wrapper for Guzzle client
47

Larablocks Analysis

nnjeim/fetch works with any PHP project: the latest release (1.1.1, Oct 11, 2021) doesn't depend on Laravel.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • No release in the last 12 months (last: Oct 11, 2021)
  • 0 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Oct 11, 2021.
  • No releases in the last 12 months.
  • First released: Sep 18, 2021.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 3, 2026.

Install
composer require nnjeim/fetch
Latest Version:1.1.1
PHP:>=7.4
License:MIT
Last Updated:Oct 12, 2021
Links: GitHub  ·  Packagist
Maintainer: nnjeim

Nnjeim Guzzle Wrapper

A Laravel wrapper for the Guzzle client http library. It provides a fluent syntax to make http requests.

Installation

You can install the package via composer:

composer require nnjeim/fetch

Configuration

php artisan vendor:publish --provider="Nnjeim\Fetch\FetchServiceProvider"

Usage

Fetch Facade
use Nnjeim\Fetch\Fetch;

$countries = Fetch::setBaseUri('https://someapi.com')->get('countries');
FetchHelper Instantiation
use Nnjeim\Fetch\FetchHelper;

private $fetch;

public function __construct(FetchHelper $fetch) {

    $this->fetch = $fetch;
}

.
.
.
return $this->fetch
        ->setBaseUri('https://someapi.com')
        ->get('countries');

Methods

Set the headers
Set the http headers  

@return $this       setHeaders(array $headers)
Set the base uri
Sets the base uri for the composition of the http request url.   

@return $this       setBaseUri(string 'http://someapi.com/')
Set the request url
Sets the http request url.   

@return $this       setUrl(string $url)
Set the request method
Sets the http request method.   

@return $this       setMethod(string $method)
Set the request body format
Sets the request body format. The required format are 'query' | 'form_params' | 'multipart'.  

@return $this       setBodyFormat(string $format)
Async request
Sets the type of the request to async.  

@return $this       setAsync()       
Get request
Sets the body format to query.

@return array       get(?string $url = null, ?array $data = null)
Post request
Sets the body format to form-params.

@return array       post(?string $url = null, ?array $data = null)
Put request
Sets the body format to form-params.

@return array       put(?string $url = null, ?array $data = null)
Delete request
Sets the body format to query.

@return array       delete(?string $url = null, ?array $data = null)
Upload request
Sets the body format to multipart.

@return array       upload(?string $url = null, ?array $data = null)

Response

@return array

    [
        'response' => ...,
        'status' => ...,
    ];

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Alternatives to nnjeim/fetch

hannesvdvreken/guzzle-debugbar

A Guzzle middleware that logs requests to debugbar's timeline

453,141 76
cline/relay

A modern, attribute-driven HTTP client for PHP

13,517 0
othercode/rest

Rest client to make GET, POST, PUT, DELETE, PATCH, etc calls.

50,706 11
sarahman/guzzle-client-trait

This package is intended to handle guzzle client creation, its api calls & their...

5,055 0
echoproxy/sdk-laravel

Laravel SDK for EchoProxy — captures HTTP traffic and ships it to ingest-api. Se...

1,402 0

Version History

Version Released PHP License
1.1.1 >=7.4 MIT
1.1.0 >=7.4 MIT
1.0.1 >=7.4 MIT