src/Environaut/Checks/Validator.php
public static function validIpv4($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty IPv4 address given.");
        }

        if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            throw new \InvalidArgumentException("Invalid IPv4 address given.");
        }

        return $value;
    }
public static function validIpv4($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty IPv4 address given.");
        }

        if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            throw new \InvalidArgumentException("Invalid IPv4 address given.");
        }

        return $value;
    }
Validates the given value using the PHP filter_var with
FILTER_VALIDATE_IP and flag FILTER_FLAG_IPV4.

@param string $value IP to validate

@return string ipv4 (may still be in private or reserved range)

@throws \InvalidArgumentException in case of validation errors (invalid or empty ip)