Download the PHP package thingston/psr18 without Composer

On this page you can find all versions of the php package thingston/psr18. 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 psr18

thingston/psr18

Implementation of PSR-18 standard for sending HTTP requests and receiving HTTP responses.

Requirements

Installation

Quick start

Configuration

Client accepts optional named parameters for every concern. All policy parameters default to null (disabled):


Redirect policy

Controls whether and how the client follows HTTP redirects. By default the client does not follow redirects unless a RedirectPolicy is provided.

Parameter Type Default Effect
$followRedirects bool true Sets CURLOPT_FOLLOWLOCATION
$maxRedirects int 10 Sets CURLOPT_MAXREDIRS
$preserveMethod bool false Sets CURLOPT_POSTREDIR = CURL_REDIR_POST_ALL

RedirectPolicy::resolveLocation(string $location, RequestInterface $request): string is a utility for resolving relative Location header values when handling redirects manually.


Retry policy

Retries are opt-in and default to idempotent methods only (GET, HEAD, OPTIONS, PUT, DELETE, TRACE). The default failure set retries common transient cURL errors and HTTP 408, 425, 429, 500, 502, 503, 504.

Parameter Type Default Effect
$maxRetries int 0 Maximum retry attempts
$delayMilliseconds int 100 Base delay between retries
$backoffMultiplier float 1.0 1.0 = constant; 2.0 = exponential doubling
$maxDelayMilliseconds int 0 Cap on computed delay; 0 = no cap
$methods string[] GET,HEAD,OPTIONS,PUT,DELETE,TRACE HTTP methods eligible for retry
$statusCodes int[] 408,425,429,500,502,503,504 HTTP status codes that trigger a retry
$errorCodes int[]\|null transient cURL errors cURL error codes that trigger a retry; null = built-in defaults

When the server returns a Retry-After header on a retryable response, the client honours it (capped at 60 s) instead of using the computed delay.


TLS policy

Groups SSL/TLS configuration into a named object rather than raw cURL option arrays.


Timeout policy

Separates connection timeout from transfer timeout.

Parameter Type Default Effect
$connectTimeoutMs int 10_000 Sets CURLOPT_CONNECTTIMEOUT_MS
$transferTimeoutMs int 0 (unlimited) Sets CURLOPT_TIMEOUT_MS; 0 disables the transfer timeout

TimeoutPolicy takes precedence over any equivalent options set in RequestOptions.


Auth policy

Handles Basic, Bearer, and Digest authentication without manually building Authorization headers.

Basic and Bearer auth inject an Authorization header. Digest auth uses curl's native challenge-response mechanism via CURLOPT_HTTPAUTH.


Proxy options


Concurrent requests

MultiClient wraps curl_multi_* and sends multiple requests in parallel. It accepts the same policy parameters as Client except retryPolicy, circuitBreaker, logger, and middleware.


Cookie jar

Persists session cookies across requests using CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR. A temporary file is created automatically when no path is given and deleted on destruction.

CookieJar::getPath(): string returns the underlying file path. CookieJar::clear(): void truncates the file, discarding all stored cookies without changing the path.


Circuit breaker

Opens the circuit after a configurable number of consecutive failures and throws immediately — without attempting the request — until the reset timeout elapses.

States: closed (normal) → open (blocking) → half-open (probe allowed) → closed.


Middleware

A MiddlewareInterface pipeline wraps sendRequest() with cross-cutting behaviour. Middleware runs in registration order (first registered = outermost wrapper).


PSR-3 logging

Inject any Psr\Log\LoggerInterface to receive structured log entries for requests, responses, retries, and errors. Zero-cost when no logger is injected.

Log levels: debug for normal request/response, warning for retries and failures.


Raw cURL options

For anything not covered by a policy, pass raw cURL options via RequestOptions or ResponseOptions. Reserved options (those the client manages internally) are rejected at construction time.

RequestOptions constants: USER_AGENT, CONNECT_TIMEOUT, TIMEOUT, FOLLOW_LOCATION, MAX_REDIRECTS.

RequestOptions ships with defaults applied to every request: USER_AGENT = 'thingston/http-client' and CONNECT_TIMEOUT = 10 (seconds). These can be overridden via RequestOptions or superseded by the corresponding policy object.


Notes


All versions of psr18 with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
ext-curl Version *
psr/http-client Version ^1.0
psr/log Version ^3.0
thingston/psr17 Version ^1.0
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 thingston/psr18 contains the following files

Loading the files please wait ...