Download the PHP package aternos/curl-psr without Composer

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

aternos/curl-psr

A simple PSR-18 client implementation based on cURL that actually supports streaming both requests and responses.

Installation

In addition to PSR-18 (HTTP Client), this library also provides implementations for PSR-17 (HTTP Factories) and PSR-7 (HTTP Messages), so no other implementations need to be installed.

Usage

Creating a client

When creating a client, you can optionally provide PSR-17 ResponseFactoryInterface and UriFactoryInterface instances. By default, the client will use the Aternos\CurlPsr\Psr17\Psr17Factory class included in this library.

Additionally, you can pass an optional UriResolverInterface instance, which is used to resolve redirect targets.

Configuring the client

Since PSR-7 does not offer many request options, you can set client-wide options that are used for all requests. Requests will use the client options as they are at the moment they are sent. Changing client options will therefore not affect already running requests.

Custom cURL options

You can set custom cURL options using the setCurlOption method. Note that some options cannot be set, since they are used internally by the client.

Redirects

The client will follow redirects by default. You can set the maximum number of redirects to follow using the setMaxRedirects method. It is also possible to disable redirects using setFollowRedirects. The difference between setting the maximum number of redirects to 0 and disabling redirects is that the former will throw an exception if a redirect is received, while the latter will simply return the redirect response.

Only when status 303 See Other is received, the client will automatically change the request method to GET and remove the request body. Historically, this behavior was also sometimes present for 301 and 302, so it is possible to enable it for other status codes using the setRedirectToGetStatusCodes method.

Status 300 Multiple Choices will only be treated as a redirect if the Location header is present. Otherwise, the response will be returned as is.

To manage how redirect targets are resolved, or limit what locations the client can be redirected to, you can pass an instance of UriResolverInterface to the client constructor.

When a redirect response is received that does not prompt the client to change the request method to GET and the body stream cannot be rewound, an exception is thrown. This is because the client cannot resend the request with the same body stream.

Progress callback

The progress callback function works the same way as the CURLOPT_PROGRESSFUNCTION in cURL, except that it receives the PSR-7 request object instead of a cURL handle as the first argument. Please note that the request object passed to the callback is not necessarily same instance that was originally passed to the sendRequest method. This is because PSR-7 request objects are immutable, so the client will create a new request object if changes are necessary (e.g. to add default headers).

Sending a request

CurlPsr can send any PSR-7 request object and return a PSR-7 response object. For more information on how to use PSR-7 objects, see the PSR-7 documentation.


All versions of curl-psr with dependencies

PHP Build Version
Package Version
Requires psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/http-factory Version ^1.1
ext-curl Version *
php Version >=8.3.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 aternos/curl-psr contains the following files

Loading the files please wait ....