Uploading a directory using phpseclib3

I’m trying to use phpseclib3 to upload a directory and its contents to a remote server. Perhaps its just not possible, but I’ve tried to do the following:

$sftp = new SFTP('ip');
$sftp->login('username', 'password');
$sftp->put('directory/*', 'directory/*', SFTP::SOURCE_LOCAL_FILE);

I’ve also tried without the / and with it, but without the *. Is there a way to easily upload the directory without needing to do it manually? i.e. creating a directory on remote server then looping through local directory uploading each file individually.