Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Http Laravel Package

phrity/http

Phrity Http provides small PSR-friendly utilities for HTTP in PHP. Includes an HttpFactory wrapper that combines PSR-17 factories (or auto-configures from a single implementation) and a Serializer that converts PSR-7 requests/responses/messages to raw HTTP strings.

View on GitHub
Deep Wiki
Context7

Build Status

Phrity Http

Utilities and interfaces for handling HTTP.

Installation

Install with Composer;

composer require phrity/http

HttpFactory

Convenience wrapper for HTTP factories, where you can add all or any factories to the same class. The class will then delegate to actual implementation. If any implementation is missing, a BadMethodCallException will be thrown.

Supports RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface and UriFactoryInterface from PSR-17.

$factory = new Phrity\Http\HttpFactory(
    requestFactory: $requestFactoryImplementation,
    responseFactory: $responseFactoryImplementation,
    serverRequestFactory: $serverRequestFactoryImplementation,
    streamFactory: $streamFactoryImplementation,
    uploadedFileFactory: $ruploadedFileFactoryImplementation,
    uriFactory: $uriFactoryImplementation,
);

Popular PSR-17 implementations, such as Nyholm and Guzzle, often offer factories that support all interfaces. By using the create() method, the HttpFactory can take any implementation and configure the HttpFactory class with the factories the implementation supports.

$guzzlePsr7 = new GuzzleHttp\Psr7\HttpFactory();
$factory = Phrity\Http\HttpFactory::create($guzzlePsr7);

Serializer

The serializer takes a PSR-7 HTTP Message and converts it to string. This string representation is a "raw" representation of HTTP request or response.

$serializer = new Serializer();
$request = $serializer->request($psrRequest);
$response = $serializer->response($psrResponse);
$message = $serializer->message($psrMessage);

Versions

Version PHP
1.1 ^8.1 Serializer; HTTP messages to string representation
1.0 ^8.1 HttpFactory convenience wrapper
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor