you can also validate IP address

``` php
if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
    throw new \Exception("ip address is not valid $ip");
}
```