PHPackages                             devuri/http - 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. devuri/http

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

devuri/http
===========

A simple flexible utility for making HTTP requests.

v0.1.4(2y ago)12.8k[1 PRs](https://github.com/devuri/http/pulls)MITPHPPHP ^7.4 || ^8.0CI passing

Since Apr 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/devuri/http)[ Packagist](https://packagist.org/packages/devuri/http)[ RSS](/packages/devuri-http/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (7)Versions (9)Used By (0)

HttpClient
==========

[](#httpclient)

The `HttpClient` is a PHP component designed to facilitate HTTP requests within PHP applications. It provides a simple, flexible utility for making HTTP requests. It's a basic straightforward way to interact with RESTful APIs from PHP applications.

### Features

[](#features)

- **Flexible HTTP Requests:** Supports GET and POST requests.
- **Customizable User Agent:** Easily configure the user agent from a preset list or set a custom one.
- **API Key Support:** Integrated support for API key authentication.
- **Referrer Setting:** Ability to set the HTTP referrer header.
- **Timeout Configuration:** Set custom timeouts for HTTP requests.
- **Exception Handling:** Catches and handles exceptions during HTTP requests, providing fallbacks and error information.

Requirements
------------

[](#requirements)

- PHP 7.4 or higher.
- Composer for dependency management.

### Installation

[](#installation)

To install the `HttpClient`, you need to have Composer installed on your machine. Run the following command in your project directory:

```
composer require devuri/http
```

Usage
-----

[](#usage)

#### Basic Usage

[](#basic-usage)

```
