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

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

kuria/request-info
==================

Get information about the current HTTP request

v1.0.3(1y ago)05611MITPHPPHP &gt;=7.1

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kuria/request-info)[ Packagist](https://packagist.org/packages/kuria/request-info)[ RSS](/packages/kuria-request-info/feed)WikiDiscussions master Synced 3d ago

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

Request info
============

[](#request-info)

Get information about the current HTTP request.

[![https://travis-ci.com/kuria/request-info.svg?branch=master](https://camo.githubusercontent.com/3ddc923219e99d061bc8527da34062ce1e78cda38e808a33a143b8ffc881c6f1/68747470733a2f2f7472617669732d63692e636f6d2f6b757269612f726571756573742d696e666f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/kuria/request-info)Contents

- [Features](#features)
- [Requirements](#requirements)
- [Usage](#usage)
    - [Configuration](#configuration)
        - [Trusted proxies](#trusted-proxies)
        - [Trusted hosts](#trusted-hosts)
        - [HTTP method override](#http-method-override)
        - [Resetting configuration](#resetting-configuration)
    - [Getting request information](#getting-request-information)
        - [Headers](#headers)
        - [Trusted proxy detection](#trusted-proxy-detection)
        - [HTTPS detection](#https-detection)
        - [Client IP address](#client-ip-address)
        - [Method](#method)
        - [Scheme](#scheme)
        - [Host](#host)
        - [Port](#port)
        - [URL](#url)
        - [Base directory](#base-directory)
        - [Base path](#base-path)
        - [Path info](#path-info)
        - [Script name](#script-name)
    - [Internal cache](#internal-cache)

[Features](#id1)
----------------

[](#features)

- getting request information:
    - headers
    - HTTPS detection
    - client IP address
    - scheme
    - method
    - host
    - port
    - URL
    - base directory
    - base path
    - path info
    - script name
- trusted proxy header support (x-forwarded / forwarded)
- host validation (inc. defining specific trusted hosts or host patterns)
- optional HTTP method override support

[Requirements](#id2)
--------------------

[](#requirements)

- PHP 7.1+

[Usage](#id3)
-------------

[](#usage)

All configuration and value retrieval is done via the static `Kuria\RequestInfo\RequestInfo` class.

### [Configuration](#id4)

[](#configuration)

#### [Trusted proxies](#id5)

[](#trusted-proxies)

By default all proxy headers are ignored. To trust select proxy headers, call `RequestInfo::setTrustedProxies()`with an appropriately configured `TrustedProxies` instance.

```
