PHPackages                             armindev/curless - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. armindev/curless

ActiveLibrary[HTTP &amp; Networking](/categories/http)

armindev/curless
================

A simple PHP library to make HTTP requests using cURL in an easy and elegant way

10PHP

Since Oct 17Pushed 7mo agoCompare

[ Source](https://github.com/PouyaniArmin/Curless)[ Packagist](https://packagist.org/packages/armindev/curless)[ RSS](/packages/armindev-curless/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

curless
=======

[](#curless)

A simple PHP library to make HTTP requests using cURL in an easy and elegant way. It provides classes `Request`, `Response`, and `Client` to simplify sending requests, handling responses, and working with headers, body, files, and query parameters.

Installation
------------

[](#installation)

You can install `curless` via Composer:

```
composer require armindev/curless
```

Usage
-----

[](#usage)

### Basic GET Request

[](#basic-get-request)

```
use Armin\Curless\Client;

$client = new Client();
$response = $client->request('GET', 'https://api.example.com/search')
                   ->query(['q' => 'curless', 'page' => 1])
                   ->timeout(5)
                   ->send();

print_r($response);
```

### POST Request with JSON Body

[](#post-request-with-json-body)

```
use Armin\Curless\Client;

$client = new Client();
$response = $client->request('POST', 'https://api.example.com/create')
                   ->headers(['Content-Type' => 'application/json'])
                   ->body(['name' => 'John', 'age' => 30])
                   ->send();

print_r($response);
```

### Sending Files (multipart/form-data)

[](#sending-files-multipartform-data)

```
use Armin\Curless\Client;

$client = new Client();
$response = $client->request('POST', 'https://api.example.com/upload')
                   ->files(['file' => '/path/to/file.jpg'])
                   ->send();

print_r($response);
```

### Using Response Class

[](#using-response-class)

```
use Armin\Curless\Client;

$client = new Client();
$data = $client->request('GET', 'https://api.example.com/data')
               ->send();

$resp = $client->response($data);
echo $resp->getBody();
echo $resp->getStatus();
```

Classes / API Reference
-----------------------

[](#classes--api-reference)

### `Request`

[](#request)

Handles creating and sending HTTP requests.

**Main Methods:**

- `url(string $url)` – Set the request URL.
- `method(string $method)` – Set HTTP method (GET, POST, PUT, DELETE, etc.)
- `headers(array $headers)` – Set request headers.
- `query(array $query)` – Set query parameters.
- `body(mixed $data)` – Set request body (array, string, etc.)
- `files(array $files)` – Attach files for multipart/form-data.
- `timeout(int $seconds)` – Set timeout in seconds.
- `verifySSL(bool $verify)` – Enable/disable SSL verification.
- `send()` – Execute the request and return response array.

---

### `Response`

[](#response)

Handles the response data from a request.

**Main Methods:**

- `bodyInfo()` – Get the response body.
- `headerInfo()` – Get response headers.
- `status()` – Get HTTP status code.
- `info()` – Get all raw response data.
- `json()` – Decode response body as JSON.

---

### `Client`

[](#client)

Simplifies using `Request` and `Response` together.

**Main Methods:**

- `request(string $method, string $url)` – Initialize a request.
- `headers(array $headers)` – Set request headers.
- `body(mixed $data)` – Set request body.
- `files(array $files)` – Attach files.
- `query(array $data)` – Set query parameters.
- `timeout(int $seconds)` – Set timeout.
- `verifySSL(bool $verify)` – Enable/disable SSL verification.
- `send()` – Send the request and get raw response.
- `response(array $data)` – Wrap raw response into a `Response` object.
- `getBody()` – Get response body from `Response`.
- `getHeaders()` – Get response headers from `Response`.
- `getStatus()` – Get HTTP status code from `Response`.
- `getInfo()` – Get all raw response data from `Response`.
- `json()` – Decode response body as JSON.

Configuration / Options
-----------------------

[](#configuration--options)

`curless` allows customizing requests with the following options:

- **Timeout**
    Set a custom timeout for the request in seconds. ```
    $client->timeout(10);
    ```
- **SSL Verification**
    Enable or disable SSL certificate verification. By default, it is enabled. ```
    $client->verifySSL(false);
    ```

    - **Headers**
        Add custom headers to your request.

    ```
    $client->headers(['Authorization' => 'Bearer TOKEN']);
    ```

    - **Query Parameters**Add query parameters for GET requests or append to URL.

```
$client->query(['page' => 1, 'limit' => 20]);
```

- **Request Body**Send data in POST, PUT, or PATCH requests. Supports JSON and form data.

```
$client->body(['name' => 'John']);
```

- **Files**Attach files for multipart/form-data requests.

```
$client->files(['file' => '/path/to/file.jpg']);
```

License
-------

[](#license)

This project is licensed under the MIT License.
See the [LICENSE](LICENSE) file for more details.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance45

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a466339f302157a8be2df7595714453af381012cc190f124f65feb3c31a28ee?d=identicon)[PouyaniArmin](/maintainers/PouyaniArmin)

---

Top Contributors

[![PouyaniArmin](https://avatars.githubusercontent.com/u/98267004?v=4)](https://github.com/PouyaniArmin "PouyaniArmin (16 commits)")

### Embed Badge

![Health badge](/badges/armindev-curless/health.svg)

```
[![Health](https://phpackages.com/badges/armindev-curless/health.svg)](https://phpackages.com/packages/armindev-curless)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
