Magento 2 Tips : How to get client ip

The client ip can be retrieved using

getClientIp()

method in

Magento\Framework\HTTP\PhpEnvironment\Request

class. This is very useful , when do the ip restriction in maintenance page development.

vasan Over 6 years ago