The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Slim 3 get ip address

Kevin's Avatar


10 Dec, 2015 09:29 PM

In Slim 2, the IP address of the machine for the incoming request could be retrieved like this:

    $app = \Slim\Slim::getInstance();
    $req = $app->request()->getIp();

I'm working on a new app using Slim 3 and tried

but this does not work. How can I get the ip address in Slim 3?
  1. 1 Posted by Rob Allen on 10 Dec, 2015 09:39 PM

    Rob Allen's Avatar

    Install rka-ip-address-middleware and then use:


  2. 2 Posted by Kevin on 10 Dec, 2015 09:49 PM

    Kevin's Avatar

    Great, that worked. Thanks.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac