byjg/webrequest

A lightweight PSR-7 implementation and highly customized CURL wrapper for making REST calls.

Maintainers

πŸ‘ byjg

Package info

github.com/byjg/php-webrequest

pkg:composer/byjg/webrequest

Fund package maintenance!

byjg

Statistics

Installs: 526 491

Dependents: 10

Suggesters: 0

Stars: 6

Open Issues: 0

6.0.0 2025-11-22 05:25 UTC

Requires

Requires (Dev)

Suggests

None

Conflicts

None

Replaces

None

MIT f4e85957ea7b5647a5584a7a15594d5a07670ba2

  • JoΓ£o Gilberto MagalhΓ£es <joao.woop@byjg.com.br>

This package is auto-updated.

Last update: 2026-06-10 18:36:24 UTC


README

sidebar_key webrequest
tags
php http

Web Request

A lightweight PSR-7 implementation and highly customized CURL wrapper for making REST calls.

πŸ‘ Sponsor
πŸ‘ Build Status
πŸ‘ Opensource ByJG
πŸ‘ GitHub source
πŸ‘ GitHub license
πŸ‘ GitHub release

Overview

PHP WebRequest is a fully PSR-compliant HTTP client package that provides:

PSR Implementations

  • βœ… PSR-7 - HTTP Message Interface (Request, Response, Stream)
  • βœ… PSR-17 - HTTP Factories (Request, Response, Stream, etc.)
  • βœ… PSR-18 - HTTP Client Interface

Additional Features

  • Helper classes for common request types (JSON, Form URL Encoded, MultiPart)
  • Support for parallel HTTP requests
  • Mock client for testing

Documentation

Basic Example

<?php
// Create a request
$uri = \ByJG\Util\Uri::getInstanceFromString('http://www.example.com/page');
$request = \ByJG\WebRequest\Psr7\Request::getInstance($uri);

// Send the request
$response = \ByJG\WebRequest\HttpClient::getInstance()->sendRequest($request);

// Process the response
$statusCode = $response->getStatusCode();
$body = $response->getBody()->getContents();

Install

composer require "byjg/webrequest"

Running Tests

# Start the test server
docker-compose up -d

# Run the tests
vendor/bin/phpunit

# Stop the server
docker-compose down

Dependencies

flowchart TD
 byjg/webrequest --> psr/http-message
 byjg/webrequest --> psr/http-client
 byjg/webrequest --> ext-json
 byjg/webrequest --> byjg/uri
Loading

Open source ByJG