Download the PHP package waffle-commons/http-client without Composer

On this page you can find all versions of the php package waffle-commons/http-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package http-client

Discord PHP Version Require PHP CI codecov Latest Stable Version Latest Unstable Version Total Downloads Packagist License

Waffle HTTP Client Component

Release: 0.1.0-beta5  |  CHANGELOG.md PSR Compliance: PSR-18 (Psr\Http\Client\ClientInterface), PSR-7 messages, PSR-17 factories

A high-performance PSR-18 HTTP client tuned for FrankenPHP resident-worker proxying. Holds a single persistent \CurlHandle plus a \CurlMultiHandle, reused via curl_reset() across every sendRequest() so libcurl's DNS cache and keep-alive pool stay warm. The transfer is driven through the multi interface, so the worker parks on curl_multi_select() (a socket-level wait) instead of blocking inside curl_exec(). Bodies stream in 8 KiB chunks in both directions โ€” request bodies are pulled from the PSR-7 request stream and response bodies are pushed into a PSR-7 stream โ€” so neither side is ever materialised whole in worker memory.

Beta-2 status

No behavioural changes since Beta-1 โ€” lockstep version bump only. The client surface, security defaults, and streaming guarantees remain as described below.

๐Ÿ†• Beta-1 foundations (still current)

๐Ÿ“ฆ Installation

You also need PSR-17 factory implementations for ResponseFactoryInterface and StreamFactoryInterface. The framework defaults to waffle-commons/http; nyholm/psr7 works equally well.

๐Ÿงฑ Surface

Class Role
Waffle\Commons\HttpClient\Client final readonly PSR-18 client. Persistent cURL easy + multi handles, non-blocking transfer, hardcoded 1s connect / 10s total timeouts, request and response bodies streamed in 8 KiB chunks.
Waffle\Commons\HttpClient\Exception\HttpClientException Base class for client errors (e.g. handle init failure). Implements Psr\Http\Client\ClientExceptionInterface.
Waffle\Commons\HttpClient\Exception\NetworkException Transport-layer failures (DNS, connect/read timeout, TLS, reset). Implements Psr\Http\Client\NetworkExceptionInterface.
Waffle\Commons\HttpClient\Exception\RequestException Protocol-level failures or empty responses. Implements Psr\Http\Client\RequestExceptionInterface.

๐Ÿš€ Usage

๐Ÿ›ก๏ธ Security defaults

The client enforces a minimum security baseline that callers cannot lower:

Option Value Why
CURLOPT_PROTOCOLS CURLPROTO_HTTP \| CURLPROTO_HTTPS SEC-03 SSRF allowlist on the request URL.
CURLOPT_REDIR_PROTOCOLS CURLPROTO_HTTP \| CURLPROTO_HTTPS SEC-03 SSRF allowlist on any redirect target.
CURLOPT_SSL_VERIFYPEER true Forces full certificate validation.
CURLOPT_SSL_VERIFYHOST 2 Forces hostname match against the certificate.
CURLOPT_FOLLOWLOCATION false The client never silently follows redirects โ€” callers must handle them explicitly.
CURLOPT_CONNECTTIMEOUT_MS 1_000 Hard 1-second ceiling. Cannot be raised.
CURLOPT_TIMEOUT_MS 10_000 Hard 10-second ceiling. Cannot be raised. A hung legacy backend must never lock a worker thread.

๐Ÿ˜ PHP 8.5 features used

๐Ÿงญ Architectural boundary (mago guard)

An active dependency perimeter is enforced on every CI run by vendor/bin/mago guard (bundled into composer mago; zero baselines). The rules live in mago.toml under [guard.perimeter] โ€” a forbidden use statement fails the build, not a reviewer.

Production code under Waffle\Commons\HttpClient may depend only on:

Test code under WaffleTests\Commons\HttpClient is unrestricted (@all); the tests/src/ClientTest.php php-mock fixture is listed in [guard].excludes because it re-declares the production namespace to stub libcurl. Structural rules are guarded too: interfaces must be named *Interface, Exception\** classes must end in *Exception, and any Enum\** namespace may hold only enum declarations.

Contract-first, component-agnostic by construction: components compose through waffle-commons/contracts, never directly through one another.

๐Ÿงช Testing

The test suite uses php-mock/php-mock-phpunit to stub libcurl entry points (curl_init, curl_setopt_array, curl_multi_exec, curl_multi_info_read, โ€ฆ), so PHPUnit runs hermetically without network I/O. Dedicated tests assert the SEC-03 protocol allowlist, the chunked request-body upload, and the non-blocking multi-handle transfer.

๐Ÿ“„ License

MIT โ€” see LICENSE.md.


All versions of http-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
ext-curl Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
waffle-commons/contracts Version self.version
waffle-commons/utils Version self.version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package waffle-commons/http-client contains the following files

Loading the files please wait ...