Download the PHP package callismart/http without Composer

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

Callismart HTTP Client

A lightweight, multi-adapter HTTP client for PHP 8.1+ designed for maximum reliability across diverse hosting environments. It provides a clean, fluent API with native support for AWS Signature V4 and automatic adapter fallbacks.

Why Callismart HTTP?

Most modern PHP HTTP clients rely heavily on the cURL extension. However, in many shared hosting environments or restricted server setups, cURL may be disabled or outdated.

Callismart HTTP solves this by providing:

Installation

Install the package via Composer:

Quick Start

Basic GET Request

POST Request with JSON

Download a File

Stream a large file directly to disk without holding it in memory:

AWS Service Request (SES)

Sign and send a request to AWS:

Client Initialization

Auto-Detection (Recommended)

The client automatically detects the best available adapter in this priority order:

  1. cURL (ext-curl) — Highest performance, full feature support
  2. fopen (allow_url_fopen = On) — Fallback for shared hosting
  3. Socket (fsockopen) — Last resort, always available

Explicit Adapter Selection

If you want to force a specific adapter:

Check Current Adapter

Set Default Headers

Persistent headers applied to every request (useful for authentication):

Per-request headers always override client defaults.

Building Requests

Requests are immutable value objects built with a fluent API.

Named Constructors

Fluent Withers

All withers return a new immutable request copy:

Add a Header

JSON Body & Headers

Automatically sets Content-Type and Accept to application/json:

Add a Cookie

Stream Response to File

Downloads the response body directly to disk without buffering:

The destination directory must exist and be writable. Throws InvalidArgumentException otherwise.

Disable SSL Verification

Use only in development or testing:

Apply Multiple Options

Sending Requests

Via HttpClient

Convenience Methods

HttpClient provides shorthand methods for common patterns:

Handling Responses

Responses are immutable value objects with helper methods for common patterns.

Status Checks

Body Parsing

Headers

Cookies

Redirect Tracking

Download Responses

For buffered responses, save to file later:

Performance Metrics

HTTP Methods with Examples

GET

Retrieve data from a server:

POST

Submit data and create resources:

Custom headers:

PUT

Replace an entire resource:

PATCH

Partially update a resource:

DELETE

Remove a resource:

JSON Support

Automatic Encoding

The with_json() method automatically encodes your data and sets the correct headers:

Automatic Decoding

The json() method safely decodes JSON responses:

File Downloads

Stream to Disk (Recommended for Large Files)

Stream the response body directly to a file without buffering in memory:

The file is created at download time. On error, partially downloaded files are automatically cleaned up.

Buffer in Memory (Small Files)

For small responses, buffer in memory and save later:

Request-Level Sink

Manual sink configuration via request:

AWS Signature Version 4

Sign requests to AWS services without the full AWS SDK:

Setup

Sign a Request

The sign() method returns a new request with AWS signing headers applied:

Headers Added by the Signer

The signer adds or overwrites three headers:

All other headers (including custom ones) are preserved and included in the signature.

Example: AWS SES

Send an email via AWS SES:

Example: AWS S3

Sign a request to S3 (Get Object):

Adapters

The HTTP client uses a three-tier adapter system for maximum compatibility:

cURL Adapter

Availability: When ext-curl is loaded Features: Full support — redirects, SSL verification, cookies, timeouts Performance: Highest — uses native C implementation

fopen Adapter

Availability: When allow_url_fopen = On in php.ini Features: Redirects, SSL verification, cookies, timeouts Limitation: May not work with restrictive open_basedir settings

Socket Adapter

Availability: Always (when fsockopen function exists) Features: Redirects (manual), SSL via ssl:// wrapper, cookies Limitation: No proxy support, manual socket handling

Automatic Selection

The HttpClient tests adapters in priority order and uses the first available:

Manual Selection

Force a specific adapter:

Error Handling

Exception Hierarchy

Catch Exceptions

Common Errors

Error Cause
HttpTimeoutException Request exceeded configured timeout
HttpRequestException (DNS) Domain could not be resolved
HttpRequestException (connection) TCP connection refused or timeout
HttpRequestException (SSL) SSL certificate verification failed (when verify_ssl=true)
InvalidArgumentException Invalid URL, unsupported HTTP method, missing sink directory

Configuration Options

Request Options

Client Configuration

Requirements

Performance Tips

  1. Use Streaming for Large Files: Use with_sink() or download() to avoid buffering entire files in memory.

  2. Reuse HttpClient Instances: Create once, send many requests through it to benefit from connection pooling (cURL).

  3. Set Appropriate Timeouts: Balance between catching truly broken connections and allowing slow networks:

  4. Disable SSL Verification Only in Development: Use without_ssl_verification() only in trusted environments.

  5. Check Redirect Loops: Monitor redirect_history to detect infinite redirects:

License

This project is licensed under the MIT License. See LICENSE file for details.

Author

Callistus Nwachukwu

Contributing

Contributions are welcome. Please ensure all code follows WordPress PHP Coding Standards (K&R braces, spaces inside parentheses, tab indentation).

Support

For issues, feature requests, or questions, please visit the project repository.


All versions of http with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 callismart/http contains the following files

Loading the files please wait ...