PHPackages                             lemmon/fetch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. lemmon/fetch

AbandonedArchivedLibrary[Framework](/categories/framework)

lemmon/fetch
============

JavaScript's fetch() implementation on top of Guzzle

v0.3.0(6y ago)4414MITPHPPHP &gt;=7.0

Since Aug 23Pushed 6y ago2 watchersCompare

[ Source](https://github.com/lemmon/fetch-php)[ Packagist](https://packagist.org/packages/lemmon/fetch)[ RSS](/packages/lemmon-fetch/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Fetch, simple PHP HTTP client
=============================

[](#fetch-simple-php-http-client)

Fetch is a tiny function, wrapped around Guzzle, PHP HTTP client. Inspired by Web API fetch() function.

Examples
--------

[](#examples)

```
// plain GET request
$res = fetch('http://uuid.lemmonjuice.com/');
$body = $res->body(); // returns response body
// get JSON data
$json = fetch('http://uuid.lemmonjuice.com/', [
  'headers' => [
    'Accept' => 'application/json',
  ],
])->json();
// POST data
$res = fetch('http://httpbin.org/post', [
  'method' => 'POST',
  'headers' => [
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
  ],
  'json' => [
    'hello' => 'world',
  ],
]);
```

Installing Fetch
----------------

[](#installing-fetch)

```
composer require lemmon/fetch
```

API
---

[](#api)

```
Fetch\Response fetch(string $resource, array $init = NULL)
```

### Parameters

[](#parameters)

- `$resource` - a resource that you wish to fetch *(e.g. )*
- `$init` (optional) - options array; see Guzzle's [Request Options](http://docs.guzzlephp.org/en/stable/request-options.html) documentation page for more info about available parameters; note: use additional parameter `method` to define request method; default method is GET

### Response

[](#response)

- `ok()` - (bool) has response been successful
- `status()` - (int) status code
- `statusText()` - (string) status text
- `body()` - (string) response body
- `json(bool $assoc = FALSE)` - JSON parsed response body
- `psr()` - (GuzzleHttp\\Psr7\\Response) Guzzle's PSR-7 response (read more in Guzzle's [official documentation](http://docs.guzzlephp.org/en/stable/psr7.html#responses))

Read more
---------

[](#read-more)

- [Guzzle](https://github.com/guzzle/guzzle) - HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services
- [PSR-7](https://www.php-fig.org/psr/psr-7/) - HTTP message interfaces
- [fetch()](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch) - Web API fetch()

License
-------

[](#license)

[MIT](https://tldrlegal.com/license/mit-license)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~152 days

Total

4

Last Release

2365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69d2fc0d66f2e8e99490f3781a67d2af0d6ca9cb3e48db4a6199336344d4310c?d=identicon)[lemmon](/maintainers/lemmon)

---

Top Contributors

[![lemmon](https://avatars.githubusercontent.com/u/251591?v=4)](https://github.com/lemmon "lemmon (5 commits)")

---

Tags

curlhttppsr-7webserviceshttpclientframeworkrestcurlhttp clientweb service

### Embed Badge

![Health badge](/badges/lemmon-fetch/health.svg)

```
[![Health](https://phpackages.com/badges/lemmon-fetch/health.svg)](https://phpackages.com/packages/lemmon-fetch)
```

###  Alternatives

[eightpoints/guzzle-wsse-middleware

WSSE Middleware for Guzzle, a PHP HTTP client library and framework for building RESTful web service clients

312.1M5](/packages/eightpoints-guzzle-wsse-middleware)[gregurco/guzzle-bundle-oauth2-plugin

OAuth2 Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

13348.3k](/packages/gregurco-guzzle-bundle-oauth2-plugin)[gregurco/guzzle-bundle-cache-plugin

Cache Plugin for Guzzle Bundle, a PHP HTTP client library and framework for building RESTful web service clients

11372.1k1](/packages/gregurco-guzzle-bundle-cache-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
