PHPackages                             hitraa/openforge-curl - 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. hitraa/openforge-curl

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

hitraa/openforge-curl
=====================

A modern, open-source PHP cURL-based HTTP request handler for OpenForge projects and general use.

1.0.0(10mo ago)10MITPHPPHP &gt;=7.4CI passing

Since Jun 21Pushed 10mo agoCompare

[ Source](https://github.com/hitraa/openforge-curl)[ Packagist](https://packagist.org/packages/hitraa/openforge-curl)[ Docs](https://github.com/hitraa/openforge-curl)[ RSS](/packages/hitraa-openforge-curl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

OpenForge Curl
==============

[](#openforge-curl)

A modern, open-source PHP cURL-based HTTP request library designed for simplicity, flexibility, and clean abstraction of HTTP requests.

---

✨ Features
----------

[](#-features)

- ✅ Simple, object-oriented API
- ✅ Supports GET, POST, PUT, PATCH, DELETE, HEAD
- ✅ JSON and raw body support
- ✅ Query parameter builder
- ✅ Bearer token support
- ✅ Flexible headers and options
- ✅ PSR-4 autoloading
- ✅ Easily testable

---

📦 Installation
--------------

[](#-installation)

Use Composer:

```
composer require hitraa/openforge-curl
```

---

🚀 Usage
-------

[](#-usage)

### 🔍 GET request with query parameters

[](#-get-request-with-query-parameters)

```
use OpenForge\Curl\HttpRequest;

$response = (new HttpRequest('https://httpbin.org/get'))
    ->setMethod('GET')
    ->setData(['q' => 'openforge'])
    ->responseArray();

print_r($response);
```

### 📤 POST request with JSON body

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

```
$response = (new HttpRequest('https://httpbin.org/post'))
    ->setMethod('POST')
    ->setJson([
        'username' => 'harshal',
        'role' => 'admin'
    ])
    ->responseObject();
```

### 🧾 POST raw body

[](#-post-raw-body)

```
$response = (new HttpRequest('https://httpbin.org/post'))
    ->setMethod('POST')
    ->setRaw('Harshal')
    ->addHeader('Content-Type: application/xml')
    ->responseText();
```

---

🔐 Bearer Authentication
-----------------------

[](#-bearer-authentication)

```
$response = (new HttpRequest('https://api.example.com/secure'))
    ->setMethod('GET')
    ->setBearer('your-token-here')
    ->responseArray();
```

---

Here's a clean and professional **README block** you can insert under your `Usage` or `Advanced` section to explain the `sslVerify(false)` feature:

---

🔐 Disable SSL Verification *(for testing only)*
-----------------------------------------------

[](#-disable-ssl-verification-for-testing-only)

If you're working in a local development environment, unsecured server or dealing with self-signed certificates, you may want to disable SSL verification temporarily:

```
$response = (new HttpRequest('https://self-signed.local/api'))
    ->setMethod('GET')
    ->sslVerify(false) // ⚠️ disables certificate & hostname verification
    ->responseArray();
```

> ⚠️ **Warning:** Disabling SSL verification is **not recommended for production** use. It makes your HTTP client vulnerable to MITM (Man-in-the-Middle) attacks.

---

### 🧪 Auto-disable SSL for Local/Test Environment

[](#-auto-disable-ssl-for-localtest-environment)

You can optionally disable SSL verification based on an environment variable:

```
$response = (new HttpRequest('https://dev.api'))
    ->setMethod('GET')
    ->sslAuto(); // disables SSL if APP_ENV = local or testing
```

OR

```
// Explicitly set APP_ENV
putenv("APP_ENV=local");

// Do https cURL request
$response = (new HttpRequest('https://dev.api'))
    ->setMethod('GET')
```

By default, it checks APP\_ENV for local or testing.
You may also customize:

```
->sslAuto('MY_ENV', ['dev', 'staging'])
```

> ⚠️ This doesn't load a .env file — you must ensure environment variables are set manually or via your framework.

---

🧪 Testing
---------

[](#-testing)

Run tests via PHPUnit:

```
vendor/bin/phpunit

# running test on local machine
APP_ENV=local vendor/bin/phpunit
```

Make sure `phpunit.xml` is at the root of the project.

---

📁 Project Structure
-------------------

[](#-project-structure)

```
openforge-curl/
├── src/                  # Library source code
│   └── HttpRequest.php
├── tests/                # Unit tests
│   └── HttpRequestTest.php
├── composer.json
├── phpunit.xml
├── .gitignore
├── .gitattributes
└── README.md

```

---

🧑‍💻 Author
----------

[](#‍-author)

**Harshal Khairnar**
Founder, [Hitraa Technologies](https://hitraa.com)
📧

---

📄 License
---------

[](#-license)

[MIT License](LICENSE) © 2025 Hitraa Technologies

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance53

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0975c68c76f25061420d25b2a5d7288296f6b84ef68abad0f4a57435872230eb?d=identicon)[khairnar2960](/maintainers/khairnar2960)

---

Top Contributors

[![khairnar2960](https://avatars.githubusercontent.com/u/36232180?v=4)](https://github.com/khairnar2960 "khairnar2960 (1 commits)")

---

Tags

httprequestphpclientcurlhttp clientopenforge

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hitraa-openforge-curl/health.svg)

```
[![Health](https://phpackages.com/badges/hitraa-openforge-curl/health.svg)](https://phpackages.com/packages/hitraa-openforge-curl)
```

###  Alternatives

[smi2/phpclickhouse

PHP ClickHouse Client

83510.1M72](/packages/smi2-phpclickhouse)[aplus/http-client

Aplus Framework HTTP Client Library

2161.6M1](/packages/aplus-http-client)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)

PHPackages © 2026

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