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 8mo agoCompare

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

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

16

—

LowBetter than 4% of packages

Maintenance42

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://avatars.githubusercontent.com/u/98267004?v=4)[Armin](/maintainers/PouyaniArmin)[@PouyaniArmin](https://github.com/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

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M92](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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