1. Go to this page and download the library: Download syren7/owncloud-api-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syren7 / owncloud-api-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel {
public function registerBundles() {
$bundles = array(
// ...
new Syren7\OwncloudApiBundle\Syren7OwncloudApiBundle(),
);
// ...
}
// ...
}
// in some controller file you can do the following
$this->get('syren7_owncloud.filesystem'); //using filesystem tools on owncloud
$this->get('syren7_owncloud.user'); //managing users and groups
$this->get('syren7_owncloud.calendar'); //reading calendars and events
#Example of an response from server
//Basic example for the filesystem api
//edit the following line, if you have your vendors not installed to vendor/ Folder
meHere', 'YourOcUserName', 'YourOcPassword', 'LeaveBlankIfYouWantToWriteIntoUsersRootDirectory');
//do your operations as you would do in symfony
//List all files and directories (optional give a subdirectory as parameter)
$fs->getDirectoryContents('Optional:YourPathToADirectory');
//returns a file handle from Oc. Filname as parameter
$file = $fs->getFile('Path/To/File.txt');
//write file to local filesystem
file_put_contents('Path/To/New/Local/File.txt', $file->read());
//create a directory
$fs->createDirectory('Path/To/New/Directory/On/Your/Oc');
//remove a directory
$fs->removeDirectory('Path/To/Remove/Directory/On/Your/Oc');
//uploads a file to your oc
$fs->createFile('Local/Path/To/File.txt', 'Optional: Remote/Path/To/File');
//removes a file from your oc
$fs->removeFile($path='');
//rename a file on your cloud ($file is the file returned by $fs->getFile())
$fs->renameFile(File $file, 'newFileName.txt');
//copy a file on your cloud ($file is the file returned by $fs->getFile())
$fs->copyFile(File $file, 'newFileName.txt');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.