PHP code example of kapersoft / sharefile-api

1. Go to this page and download the library: Download kapersoft/sharefile-api 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/ */

    

kapersoft / sharefile-api example snippets


// Connect to ShareFile
$client = new Client('hostname', 'client_id', 'secret', 'username', 'password');

// Create a folder
$newFolder = $client->createFolder($parentId, $name, $description);

// Upload a file in that folder 
$client->uploadFileStandard($filename, $newFolder['Id']);

// Get details for a file using filepath
$picture = $client->getItemByPath('/Personal Folders/Pictures/Picture.jpg');

// Using file details we can ask for the thumbnail url
$client->getThumbnailUrl($picture['Id']);

// Or the direct download link
$client->getItemDownloadUrl($picture['Id']);

// Or the contents of the file
$client->getItemContents($picture['Id']);

$client = new Client('hostname', 'client_id', 'secret', 'username', 'password');