Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 25, 2024 via composer

psr/http-client 1.0.2

Common interface for HTTP clients
Package summary
Share
0
issues
1
license
1
MIT
Package created
20 Mar 2018
Version published
10 Apr 2023
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
psr/http-client@1.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of psr/http-client 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does psr/http-client do?

The psr/http-client package provides a common interface for HTTP clients in PHP. It defines abstractions that describe the components of an HTTP client but does not implement an HTTP client by itself. It serves to establish a standardized way of communicating with HTTP resources, and is particularly useful when you want to standardize or switch between different HTTP client implementations. By utilizing PSR-18, a part of PHP Standard Recommendations, this package makes sure your code remains clean and consistent across different projects.

How do you use psr/http-client?

The psr/http-client isn't a standalone package that you can directly use, but it's the basis on which compatible HTTP client libraries are built. To see its usage in action, you'd typically require a compatible HTTP client library in your PHP project using Composer, such as Guzzle or HttpPlug. Once the library is in place, here is a basic usage example:

<?php

use Psr\Http\Client\ClientInterface;

$client = new ClientInterface;

$request = new \Psr\Http\Message\RequestInterface(
    'GET', 
    'https://api.example.com'
);

$response = $client->sendRequest($request);

echo $response->getBody();

This code instantiates an HTTP client, creates a new GET request to the example API, sends the request and finally outputs the response body.

Where are the psr/http-client docs?

You can find the documentation for the psr/http-client on the PHP-FIG website, specifically the PSR-18 documentation at https://www.php-fig.org/psr/psr-18. Additionally, detailed information about the package along with potential implementations can be found at https://packagist.org/packages/psr/http-client. Keep in mind that actual usage will depend on the HTTP client library you choose, so it's crucial to refer to their individual documentation for more specific guidance.