is_dir function for FTP/FTPS connections
In case someone is interested, here's a follow up to MarcDefiant's comment about using ftp_rawlist(). It's fast if you're already using it for getting the file list as well. Here's a snippet from the filebrowser.php in my GitHub filebrowser project. It's certainly not on the same level as Flysystem but I enjoyed working on it :).

public function isDir($path,$contents=NULL){
    $name = getPathName($path);
    if($contents === NULL){
        $path = getItemPath($path);
        $contents = $this-&gt;scandir($path);
    }
    foreach($contents as $content =&gt; $data){
        if($content == $name){
            if($data['type'] == 'directory'){
                return TRUE;
            }
            return FALSE;
        }
    }
    return FALSE;
}

public function scandir($path=NULL){
    if($path === NULL){
        $path = $this-&gt;Path;
    }
    if(!$path){
        $path = ".";
    }
    if(is_array($children = @ftp_rawlist($this-&gt;conn_id, $path))){
        $items = array();

        foreach($children as $name =&gt; $child){
            if(!$name){
                continue;
            }
            $chunks = preg_split("/\s+/", $child);
            list($item['rights'], $item['number'], $item['user'], $item['group'], $item['size'], $item['month'], $item['day'], $item['time']) = $chunks;
            $item['type'] = $chunks[0]{0} === 'd' ? 'directory' : 'file';
            array_splice($chunks, 0, 8);
            $items[implode(" ", $chunks)] = $item;
        }

        return $items;
    }
    return FALSE;
}

function getPathName($path){
    return substr($path,strrpos("/".$path,"/"));
}