1. Go to this page and download the library: Download ruvart/openkm-client 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/ */
ruvart / openkm-client example snippets
php
$okmClient = new OpenKMClient($url,$user,$password, true);
//This funtion gets the route to the users folder (OpenKM User), it's the equivalent to C:\Users\user-name
//You can user any valid route if you don't wanna use the user's folder
$root = $okmClient->getRoot();
//Is a valid file
if ( $okmClient->documentIsValid($root . $file_name) ) {
echo "It's a valid file";
}
else {
echo "It's not a valid file";
}
//Filezise
$properties = $okmClient->documentGetProperties($root . $file_name);
if ( !empty($properties) && !empty($properties['actualVersion']) && !empty($properties['actualVersion']['size']) ) {
echo $properties['actualVersion']['size'];
}
//Mime info
$properties = $okmClient->documentGetProperties($root . $file_name);
if ( !empty($properties) && !empty($properties['mimeType']) ) {
echo $properties['mimeType'];
}
//Uploads a file
$okmClient->documentCreateSimple($root . $file_name, $route_to_local_file);
//rename a file
$okmClient->documentRename($root . $file_name, $only_new_name);
//copy a file
$okmClient->documentCopy($root . $file_name, $destiny_route);
//Stream a file
$okmClient->documentGetContent($root . $file_name, 'PHP:output');
//Deletes a file
$okmClient->documentDelete($root . $file_name);
//Make folder / dir
$okmClient->folderCreateSimple($root . $folder_name);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.