public static function isUri($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        // http://tools.ietf.org/html/rfc3986
        //
        // URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
        // hier-part   = "//" authority path-abempty
        //             / path-absolute
        //             / path-rootless
        //             / path-empty
        $pattern = sprintf(
            '/\A%s%s%s%s%s\z/',
            '(?:([^:\/?#]+)(:))?',
            '(?:(\/\/)([^\/?#]*))?',
            '([^?#]*)',
            '(?:(\?)([^#]*))?',
            '(?:(#)(.*))?'
        );

        preg_match($pattern, (string) $value, $matches);
        $uri = self::uriComponentsFromMatches($matches);

        return self::isValidUri($uri);
    }
public static function isUri($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        // http://tools.ietf.org/html/rfc3986
        //
        // URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
        // hier-part   = "//" authority path-abempty
        //             / path-absolute
        //             / path-rootless
        //             / path-empty
        $pattern = sprintf(
            '/\A%s%s%s%s%s\z/',
            '(?:([^:\/?#]+)(:))?',
            '(?:(\/\/)([^\/?#]*))?',
            '([^?#]*)',
            '(?:(\?)([^#]*))?',
            '(?:(#)(.*))?'
        );

        preg_match($pattern, (string) $value, $matches);
        $uri = self::uriComponentsFromMatches($matches);

        return self::isValidUri($uri);
    }
public static function isUri ( $ value ) : bool { if ( ! static :: isStringCastable ( $ value ) ) { return false ; } // http://tools.ietf.org/html/rfc3986 // // URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ] // hier-part   = "//" authority path-abempty //             / path-absolute //             / path-rootless //             / path-empty $ pattern = sprintf ( '/\A%s%s%s%s%s\z/' , '(?:([^:\/?#]+)(:))?' , '(?:(\/\/)([^\/?#]*))?' , '([^?#]*)' , '(?:(\?)([^#]*))?' , '(?:(#)(.*))?' ) ; preg_match ( $ pattern , ( string ) $ value , $ matches ) ; $ uri = self :: uriComponentsFromMatches ( $ matches ) ; return self :: isValidUri ( $ uri ) ; }
Checks if value is a URI

@param mixed $value The value

@return bool
Checks if value is a URI