PHPackages                             phpnomad/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. [HTTP &amp; Networking](/categories/http)
4. /
5. phpnomad/fetch

ActiveLibrary[HTTP &amp; Networking](/categories/http)

phpnomad/fetch
==============

Client-side HTTP requests and strategies.

1.0.5(3w ago)04.9k↓15%[2 PRs](https://github.com/phpnomad/fetch/pulls)3MITPHPCI passing

Since Dec 21Pushed 2w ago2 watchersCompare

[ Source](https://github.com/phpnomad/fetch)[ Packagist](https://packagist.org/packages/phpnomad/fetch)[ Docs](https://github.com/phpnomad/core)[ RSS](/packages/phpnomad-fetch/feed)WikiDiscussions main Synced yesterday

READMEChangelog (5)Dependencies (4)Versions (10)Used By (3)

phpnomad/fetch
==============

[](#phpnomadfetch)

[![Latest Version](https://camo.githubusercontent.com/8a5b50fcd153bfb9cdb5d7571fb42ecc4bc61814f8ae0d54266d587c4f1039bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f66657463682e737667)](https://packagist.org/packages/phpnomad/fetch)[![Total Downloads](https://camo.githubusercontent.com/651c1bfeb0bebe718b5156a64e3a1e6c29631a96ac643051926da68f6b3eb235/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f66657463682e737667)](https://packagist.org/packages/phpnomad/fetch)[![PHP Version](https://camo.githubusercontent.com/210bd54d10484318f2eac38d614afb1d9f5d38c71eb19b8c8836eca84c584fb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f66657463682e737667)](https://packagist.org/packages/phpnomad/fetch)[![License](https://camo.githubusercontent.com/9f80cd9a0833177e606d8efa228b207b51395c719c11b74540305f58710e3a9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f66657463682e737667)](https://packagist.org/packages/phpnomad/fetch)

`phpnomad/fetch` is the client-side HTTP abstraction for PHPNomad applications. It defines the `FetchStrategy` interface that application code depends on when it needs to make outbound HTTP requests, along with a `FetchPayload` value object and a fluent builder for assembling requests.

The package intentionally ships no transport of its own. Concrete implementations live in integration packages so your application code stays portable across runtimes. Pair it with `phpnomad/guzzle-fetch-integration` for Guzzle-backed transport, with the `FetchStrategy` in `phpnomad/wordpress-integration` for a `wp_remote_request`-backed transport, or write your own by implementing the interface. The same calling code works in every case. `phpnomad/fetch` powers outbound HTTP in [Siren](https://sirenaffiliates.com) and several other PHPNomad-based systems in production.

Installation
------------

[](#installation)

```
composer require phpnomad/fetch
```

You also need a strategy implementation. The common choices are `phpnomad/guzzle-fetch-integration` and the `FetchStrategy` included in `phpnomad/wordpress-integration`.

Quick Start
-----------

[](#quick-start)

Build a `FetchPayload` and hand it to the strategy. The example below makes a GET request to a JSON API with a custom header and two query parameters.

```
