PHPackages                             otifsolutions/curl-handler - 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. otifsolutions/curl-handler

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

otifsolutions/curl-handler
==========================

This package provides a eaisy access to api data in the project by simply giving the method,url and parameters

V1.0.7(1y ago)23.5k11MITPHP

Since Apr 1Pushed 1y ago1 watchersCompare

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

READMEChangelog (7)DependenciesVersions (9)Used By (1)

**Curl-Handler**
================

[](#curl-handler)

An Easy to use Curl class. Allows single-line easy API calls.

### **Requirements**

[](#requirements)

`PHP 7 > PHP 8.1`

**How to use the Library**

Install via Composer **[Composer](https://getcomposer.org/download)** (Recommended)

**Using Composer (Recommended)**

```
composer require otifsolutions/curl-handler

```

Namespace for the package class

```
use OTIFSolutions\CurlHandler\Curl
```

**Methods used with the package's curl class**

`url('')`

`header([])`

`params([])`

`body([])`

`referer('')`

`agent('')`

`execute()`

```
getCurlErrors();    // used to display errors if any
```

**Supported Request Methods:**

`GET`

`POST`

`PUT`

`DELETE`

**How to use the package:**

```
use OTIFSolutions\CurlHandler\Curl;
use OTIFSolutions\CurlHandler\Exceptions\CurlException;

try{

    Curl::Make()
        ->GET // this could be, get, post, put, delete
        ->url('REQUEST_URL_GOES_HERE')
        ->header(['AUTHENTICATION_ARRAY_GOES_HERE'])
        ->body(['BODY_ARRAY_GOES_HERE'])
        ->referer('https://www.google.com')
        ->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.12011-10-16 20:23:00')
        ->params(['PARAMETERS_ARRAY_GOES_HERE'])
        ->execute();
}

catch(CurlException $ce){
    return ($ce->getCurlErrors());
}
```

**Method signatures of all the methods/requests used in the package**

```
`url('STRING') : Object`,
`header(['ARRAY']) : Object`,
`body(['ARRAY']) : Object`,
`params(['ARRAY]) : Object`,
`referer('STRING') : Object`,
`agent('STRING') : Object`,
`execute() : array`,
`getCurlErrors() : array`,
`isJson('string'): bool`,
`isDomDocument('string'): bool`,
`domToArray($node): mixed`

```

If you are using `PhpStorm IDE` then you don't have to check method signatures every time, just go to the method, click it, then do `CTRL + Q` on it, everything that belongs to this method, will be shown.

**Get request for API call**

```
use OTIFSolutions\CurlHandler\Curl;

Curl::Make()
    ->GET
    ->url('URL_GOES_HERE')
    ->header(['AUTHENTICATION_ARRAY_GOES_HERE'])
    ->params(['PARAMS_ARRAY_GOES_HERE'])
    ->execute();
```

**Post request**

```
use OTIFSolutions\CurlHandler\Curl;

Curl::Make()
    ->POST
    ->url('URL_GOES_HERE')
    ->header(['AUTHENTICATION_ARRAY_GOES_HERE'])
    ->body(['BODY_ARRAY_GOES_HERE'])
    ->params(['PARAMS_ARRAY_GOES_HERE'])
    ->execute();
```

**Put Request**

```
use OTIFSolutions\CurlHandler\Curl;

Curl::Make()
    ->PUT
    ->url('URL_GOES_HERE')
    ->header(['AUTHENTICATION_ARRAY_GOES_HERE'])
    ->body(['BODY_ARRAY_GOES_HERE'])
    ->params(['PARAMS_ARRAY_GOES_HERE'])
    ->execute();
```

**Delete request**

```
use OTIFSolutions\CurlHandler\Curl;

Curl::Make()
    ->DELETE
    ->url('URL_GOES_HERE')
    ->header(['AUTHENTICATION_ARRAY_GOES_HERE'])
    ->params(['PARAMS_ARRAY_GOES_HERE'])
    ->execute();
```

**Note (Precaution):**

If you call any method that does not belong to the `OTIFSolutions\CurlHandler\Curl::class` or give any parameter that it does not understand, then you will see the error messages.

**Realtime example you can check**

This example demonstrates the usage of `curl-handleer` with `get` method, have a look at

**[laravel-currency-layer/Commands/FetchCurrencyRates](https://github.com/otifsolutions/laravel-currency-layer/blob/main/src/Commands/FetchCurrencyRates.php)**

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.7% 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

Every ~167 days

Recently: every ~153 days

Total

8

Last Release

705d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f9aeabc454ee05b530e6234f1689a89e8f63bc766e647ad78bec54add4215b4?d=identicon)[otifsolutions](/maintainers/otifsolutions)

---

Top Contributors

[![junaidmaqbutt](https://avatars.githubusercontent.com/u/13379343?v=4)](https://github.com/junaidmaqbutt "junaidmaqbutt (17 commits)")[![danish9811](https://avatars.githubusercontent.com/u/100212323?v=4)](https://github.com/danish9811 "danish9811 (7 commits)")[![talharehman12](https://avatars.githubusercontent.com/u/80828854?v=4)](https://github.com/talharehman12 "talharehman12 (3 commits)")[![mtayyab7725](https://avatars.githubusercontent.com/u/66251458?v=4)](https://github.com/mtayyab7725 "mtayyab7725 (1 commits)")

### Embed Badge

![Health badge](/badges/otifsolutions-curl-handler/health.svg)

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

###  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)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

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

78126.4M414](/packages/react-http)

PHPackages © 2026

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