PHPackages                             jichangfeng/request-url - 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. jichangfeng/request-url

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

jichangfeng/request-url
=======================

RequestUrl is a PHP HTTP client library

v1.5(2y ago)41.5k2MITPHPPHP &gt;=5.3

Since Aug 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jichangfeng/request-url)[ Packagist](https://packagist.org/packages/jichangfeng/request-url)[ Docs](http://github.com/jichangfeng/request-url)[ RSS](/packages/jichangfeng-request-url/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Request Url for PHP
===================

[](#request-url-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/9e4b5c17824e733c78d6fe52c0c4207d1f64554ccecd4a37ec5d77f2fd60b581/68747470733a2f2f706f7365722e707567782e6f72672f6a696368616e6766656e672f726571756573742d75726c2f762f737461626c652e706e67)](https://packagist.org/packages/jichangfeng/request-url)[![Total Downloads](https://camo.githubusercontent.com/4a5a7aca2f0ec8ef8cf8802690d102f8c81c6d468e45280b5a50306f37e1fdb0/68747470733a2f2f706f7365722e707567782e6f72672f6a696368616e6766656e672f726571756573742d75726c2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/jichangfeng/request-url)[![License](https://camo.githubusercontent.com/01c2d1ae411e423f38584bde2f7237da244e3e2e079d48d69a9c8a76a8134087/68747470733a2f2f706f7365722e707567782e6f72672f6a696368616e6766656e672f726571756573742d75726c2f6c6963656e73652e706e67)](https://packagist.org/packages/jichangfeng/request-url)

RequestUrl is a PHP HTTP client library.

RequestUrl allows you to send **GET**, **POST**, **PUT**, **DELETE** HTTP requests. You can enable cookie, enable gzip, set user-agent, set referer, set timeout, set connect timeout and set proxy. You can add headers, form data, and parameters with simple arrays, and access the response data in the same way.

RequestUrl uses cURL, but abstracts all the nasty stuff out of your way, providing a simple API.

Install
=======

[](#install)

`composer require jichangfeng/request-url`

Usage
=====

[](#usage)

```
// Complex request
$result = RequestUrl::getInstance()
        ->enableCookie('test.tmp')
        ->enableGzip(true)
        ->setUserAgent('Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36')
        ->setReferer('https://example.com')
        ->setTimeout(10)
        ->setConnectTimeout(5)
        ->setHeaders(array('Accept' => 'application/json'))
        ->setParams(array('name' => 'admin', 'password' => '123456'))
        ->setProxy('127.0.0.1', 1080)
        ->post('https://www.example.com/user/login');

// Simple request
$result = RequestUrl::getInstance()->get('https://www.example.com');
$result = RequestUrl::getInstance()->setParams(array('key' => 'value'))->post('https://www.example.com');

// application/x-www-data-urlencoded
//   application/x-www-form-urlencoded is the default form submission format.
//   When using cURL to send a request, if the Content-Type is not set, this format will be used by default.
$result = RequestUrl::getInstance()
        ->setParams(array('key' => 'value'))
        ->post('https://www.example.com');
//   But if this header is set manually, cURL will send the request body as a plain text string instead of form-encoded.
//   At this time, you must use the http_build_query() function to manually build form data.
$result = RequestUrl::getInstance()
        ->setHeaders(array('Content-Type' => 'application/x-www-data-urlencoded'))
        ->setParams(http_build_query(array('key' => 'value')))
        ->post('https://www.example.com');

// multipart/form-data
$result = RequestUrl::getInstance()
        ->setHeaders(array('Content-Type' => 'multipart/form-data'))
        ->setParams(array('avatar' => new CURLFile('/tmp/avatar.png'), 'nickname' => 'coco'))
        ->post('https://www.example.com');

// application/json
$result = RequestUrl::getInstance()
        ->setHeaders(array('Content-Type' => 'application/json'))
        ->setParams(json_encode(array('key' => 'value')))
        ->post('https://www.example.com');

var_dump($result['body']);
// string '[...]'... (length=1270)

var_export($result['header']);
/*
'HTTP/2 200
cache-control: max-age=604800
content-type: text/html; charset=UTF-8
date: Tue, 13 Aug 2019 10:26:21 GMT
etag: "1541025663+ident"
expires: Tue, 20 Aug 2019 10:26:21 GMT
last-modified: Fri, 09 Aug 2013 23:54:35 GMT
server: ECS (dcb/7F38)
vary: Accept-Encoding
x-cache: HIT
content-length: 1270

'
*/

$headers = RequestUrl::getInstance()->parseHeader($result['header']);
var_export($headers);
/*
array (
  'cache-control' => 'max-age=604800',
  'content-type' => 'text/html; charset=UTF-8',
  'date' => 'Tue, 13 Aug 2019 10:26:21 GMT',
  'etag' => '"1541025663+ident"',
  'expires' => 'Tue, 20 Aug 2019 10:26:21 GMT',
  'last-modified' => 'Fri, 09 Aug 2013 23:54:35 GMT',
  'server' => 'ECS (dcb/7F38)',
  'vary' => 'Accept-Encoding',
  'x-cache' => 'HIT',
  'content-length' => '1270',
)
*/

var_export($result['info']);
/*
array (
  'url' => 'https://www.example.com',
  'httpCode' => 200,
  'contentType' => 'text/html; charset=UTF-8',
  'contentTypeDownload' => 1270.0,
  'sizeDownload' => 1270.0,
  'elapsedTime' => 1.7826,
  'errno' => 0,
  'error' => '',
  'proxy' => false,
)
*/
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Every ~291 days

Recently: every ~354 days

Total

6

Last Release

1013d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/091305370ead8ea96ed538bba46a3d6a70eebe8c16e3a272c0033cc8a3f18497?d=identicon)[jichangfeng](/maintainers/jichangfeng)

---

Top Contributors

[![jichangfeng](https://avatars.githubusercontent.com/u/34360195?v=4)](https://github.com/jichangfeng "jichangfeng (8 commits)")

---

Tags

httpclientrestcurlhttp client

### Embed Badge

![Health badge](/badges/jichangfeng-request-url/health.svg)

```
[![Health](https://phpackages.com/badges/jichangfeng-request-url/health.svg)](https://phpackages.com/packages/jichangfeng-request-url)
```

###  Alternatives

[zoonman/pixabay-php-api

PixabayClient is a PHP HTTP client library to access Pixabay's API

3354.7k](/packages/zoonman-pixabay-php-api)[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[opgg/riotquest

RiotQuest, PHP RiotAPI client library that focused on multi request from OP.GG

172.6k](/packages/opgg-riotquest)

PHPackages © 2026

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