phpseclib\Net\SFTP::symlink PHP Method

    function symlink($target, $link)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }
        //$target = $this->_realpath($target);
        $link = $this->_realpath($link);
        $packet = pack('Na*Na*', strlen($target), $target, strlen($link), $link);
        if (!$this->_send_sftp_packet(NET_SFTP_SYMLINK, $packet)) {
            return false;
        }
        $response = $this->_get_sftp_packet();
        if ($this->packet_type != NET_SFTP_STATUS) {
            throw new \UnexpectedValueException('Expected SSH_FXP_STATUS');
        }
        if (strlen($response) < 4) {
            return false;
        }
        extract(unpack('Nstatus', Strings::shift($response, 4)));
        if ($status != NET_SFTP_STATUS_OK) {
            $this->_logError($response, $status);
            return false;
        }
        return true;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function link($remoteSource, $remoteTarget)
 {
     if ($this->isConnected()) {
         return $this->connection->symlink($remoteSource, $remoteTarget);
     }
     return false;
 }