$ssh_con = ssh2_connect('example.com'); ssh2_auth_password($ssh_con, 'username', 'password'); $remote_fs = oc\fs\Filesystem::mount("ssh2.sftp://{$ssh_con}/var/www/html/files"); // Now we can operate on the `$remote_fs` object as though it were a local filesystem echo file_get_contents($remote_fs->getPath('file.txt')); // Output the contents of file.txt
$compressed_fs = oc\fs\Filesystem::mount("phar://" . __DIR__ . "/archive.zip"); // Now we can operate on the `$compressed_fs` object as though it were a normal directory mkdir($compressed_fs->getPath('new_dir')); $compressed_fs->write('new_dir/file.txt', 'Hello world'); echo file_get_contents($compressed_fs->getPath('new_dir/file.txt')); // Output: "Hello world"To use `oc.files`, you need to install the `owncloud-files` package, which is a part of the OwnCloud ecosystem. However, the library can be used standalone, without the need for the OwnCloud server.