Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/aportela/httprequest-wrapper

Custom php (curl) http request wrapper
https://github.com/aportela/httprequest-wrapper

composer-package curl http http-client php php8

Last synced: 1 day ago
JSON representation

Custom php (curl) http request wrapper

Awesome Lists containing this project

README

        

# httprequest-wrapper

This is a simple library to wrap & manage native PHP HTTP requests (there are plenty of serious alternatives like [Guzzle](http://docs.guzzlephp.org/), this is my tiny approach to be used in some of my personal projects, should not be taken too seriously).

## Requirements

- mininum php version 8.x
- curl extension must be enabled

## Limitations

At this time only GET/HEAD methods are supported.

## Install (composer) dependencies:

```
composer require aportela/httprequest-wrapper
```

## Code example:

```
GET("https://packagist.org/packages/aportela/httprequest-wrapper");

print_r($response);
```

## Response object struct:

code: HTTP response code (int)
contentType: response content type (string)
headers: response headers (array)
body: response body contents

![PHP Composer](https://github.com/aportela/httprequest-wrapper/actions/workflows/php.yml/badge.svg)