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

ActiveLibrary

proteins/request
================

Handles the HTTP request for the current execution

1.0.4(6y ago)0431MITPHPPHP ^7.2

Since May 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/php-protein/request)[ Packagist](https://packagist.org/packages/proteins/request)[ RSS](/packages/proteins-request/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (4)Versions (5)Used By (1)

[![](https://raw.githubusercontent.com/php-protein/docs/master/assets/protein-large.png)](https://raw.githubusercontent.com/php-protein/docs/master/assets/protein-large.png)

Protein | Request
=================

[](#protein--request)

Handles the HTTP request for the current execution.
---------------------------------------------------

[](#handles-the-http-request-for-the-current-execution)

### Install

[](#install)

---

```
composer require proteins/request

```

Require the class via :

```
use Proteins\Request;
```

### Getting an input parameter

[](#getting-an-input-parameter)

---

Inputs passed to the request can be retrieved with the `Request::input($key=null, $default=null)` method.

The function searches for an input named `$key` in the `$_REQUEST` superglobal, if not found returns the `$default` value passed (resolved if `$default` is callable).

If you call `Request::input()` it will returns an associative array of all `$_REQUEST` content.

`$_GET`, `$_POST`, `$_FILES`, `$_COOKIE` can be accessed directly with the `Request::get/post/files/cookie` methods.

```
echo "Hello, ", Request::input('name','Friend'), '!';
```

```
GET /?name=Alyx

```

```
Hello, Alyx!

```

### Getting the URL / URI

[](#getting-the-url--uri)

---

The `Request::URL()` method returns the current request URL, complete with host and protocol.

The `Request::URI()` method returns the current request URL, without host and protocol and relative to the front controller path.

```
DocumentRoot : /web/mysite.com/public
Front Controller Path : /web/mysite.com/public/foo/bar/index.php

Request::URL() –> http://mysite.com/foo/bar/someroute
Request::URI() –> /someroute

```

### Getting the HTTP method

[](#getting-the-http-method)

---

The `Request::method()` method returns the current request HTTP method, lowercase.

```
echo Request::method();
```

```
get

```

### Getting RAW/JSON data

[](#getting-rawjson-data)

---

If data was passed with the request, the method `Request::data($key=null, $default=null)` will retrieve all (if called with no parameters) data or a single property if `$key` is passed.

If requested data was empty, `$default` will be returned (resolved if callable is passed).

If request data is passed with the `Content-Type: application/json` header, will be automatically decoded.

```
POST /
Content-Type: application/json

{
 "name": "Chell"
}
```

```
print_r( Request::data() );
```

```
stdClass Object
(
    [name] => Chell
)
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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 ~0 days

Total

4

Last Release

2544d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b00a7323d0ef535e352696bc141305b3928fce777a0f477109d2274ad17cdb9f?d=identicon)[lastguest](/maintainers/lastguest)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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