2017 © Pedro Peláez
 

library middleware-ip-address

image

litphp/middleware-ip-address

  • Monday, February 12, 2018
  • by mcfog
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

LitPHP/middleware-ip-adress

Scrutinizer Code Quality Code Coverage Build Status, (*1)

PSR-15 middleware for get client ip address from request, (*2)

a complete rewrite of akrabat/rka-ip-address-middleware, using most of it's test cases, (*3)

Features

  • based on PSR-15
  • require PHP>=7.1 (for nullable typehint, and 7.0's lifecycle is in fact shorter than 5.6)
  • MUST provide $trustedProxies in order to inspect forwarding headers (security by default)
  • instead of use magic attribute name, use class name to attach the class instance to request

Example

<?php
use Lit\Middleware\IpAddress;

//bootstraping
$ipAddress = new IpAddress(['YOUR_TRUSTED_REVERSE_PROXY']);
ADD_MIDDLEWARE_TO_YOUR_APP($ipAddress, $app);

//in your business logic
$ip = IpAddress::fromRequest($request)->getIpAddress(); //string|null

The Versions

12/02 2018

dev-master

9999999-dev

  Sources   Download

ISC

The Requires

 

The Development Requires

by McFog Wang

26/12 2017

v0.1.0

0.1.0.0

  Sources   Download

ISC

The Requires

 

The Development Requires

by McFog Wang