How do I get the user IP address in Symfony2 controller?

You can get the client IP using Request service:

$container->get('request')->getClientIp();

Leave a Comment