Download the PHP package netglue/realip-helpers without Composer

On this page you can find all versions of the php package netglue/realip-helpers. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package realip-helpers

Helpers for retrieving the real client IP in Laminas/Mezzio Projects

Latest Stable Version codecov PHPUnit Test Suite

Why?

I put this together to scratch an itch - I typically write server-side apps using Mezzio or Laminas MVC (Formerly Expressive and Zend Framework) and there's an existing middleware implementation akrabat/ip-address-middleware, that already solves the problem of getting the remote address, optionally from common proxy headers with PSR-7/PSR-15 middleware.

The problem I had with that package is that it requires an array of trusted proxies in order to perform searches of those headers, so if your app is behind a load balancer, and it's IP might change, this means that updating your config is a pain, particularly if you're using the component in multiple projects on the same environment. Also, this package introduces the concept of a trusted header, i.e. if you've got an upstream proxy you can guarantee will send you a header with the remote address, and you're confident your proxy cannot be circumvented, then you can ignore the idea of trusted proxies and just use that header. Furthermore, I wanted the convenience of default configuration and DI factories for the middleware and helpers. You may also want to checkout this too: middlewares/client-ip.

Install

Install with Composer using "netglue/realip-helpers"

Configure

Without any additional configuration, the helper(s) will simply return whatever $_SERVER['REMOTE_ADDR'] reports (But sanitised and validated as an actual IP address). The reason you're looking at this is probably because REMOTE_ADDR doesn't cut it… Options are detailed in ./src/ConfigProvider.php and repeated below. The values are the defaults.

MVC Usage

Config should be injected automatically if you are using Laminas component installer, so it's just a case of altering config values for your environment if appropriate and then issuing a $ip = $this->clientIp() from a controller method to retrieve the remote IP address.

Mezzio Usage

Add NetglueRealIP\Middleware\IpAddress::class to your pipeline, and your request will contain the attribute 'ip_address', i.e. $request->getAttribute('ip_address'). You can change the name of the attribute at construction time if you are not using a DI container, or if you are, by aliasing the class to a different factory.

Test

cd to wherever the module is installed, issue a composer install followed by a composer test.

Contributions

PR's are welcomed. Please write tests for new features.

Support

You're welcome to file issues, but please understand that finding the time to answer support requests is very limited so there might be a long wait for an answer.

About

Netglue makes websites and apps in Devon, England. We hope this is useful to you and we’d appreciate feedback either way :)


All versions of realip-helpers with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
psr/container Version ^1.0
psr/http-server-middleware Version ^1.0
psr/http-server-handler Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package netglue/realip-helpers contains the following files

Loading the files please wait ....