1. Go to this page and download the library: Download mediasilo/phoenix-php-sdk 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/ */
mediasilo / phoenix-php-sdk example snippets
php composer.phar --version
php composer.phar install
ediasilo\MediaSiloAPI;
// Set your credentials
$username = "PoohBear";
$password = "T!gger!sPushy";
$host = "100acreforest";
// Instantiate client
try {
$mediaSiloAPI = MediaSiloAPI::createFromHostCredentials($username, $password, $host);
}
catch(\mediasilo\http\exception\NotAuthenticatedException $e) {
print "Bad credentials. Cat on the keyboard? \n";
exit;
}
// Start making some calls
$me = $mediaSiloAPI->me();
... Initialize the API as shown above
// Here's the project we're interested in traversing
$projectId = "07706DCC-014B-2CE0-CF518D31A23C393E";
// Let's find everything at the root of the projects
$rootLevelAssets = $mediaSiloApi->getAssetsByProject($projectId);
$rootLevelFolders = $mediaSiloApi->getProjectFolders($projectId);
// Ok, now let's traverse the prject to find the rest of the assets
foreach($rootLevelFolders as $folder) {
get_folder_contents($mediaSiloApi, $folder->id);
}
function get_folder_contents($mediaSiloApi, $folderId) {
print "FolderId:".$folderId."\n";
try {
$assets = $mediaSiloApi->getAssetsByFolder($folderId);
var_dump($assets);
}
catch(NotFoundException $e) {
print "There are not assets in this folder. Better get cracking and add some! \n";
}
try {
$subfolders = $mediaSiloApi->getSubfolders($folderId);
foreach($subfolders as $subfolder) {
get_folder_contents($mediaSiloApi, $subfolder->id);
}
}
catch(NotFoundException $e) {
print "No more folders here!";
}
}
bash
cd <YOUR PROJECT ROOT>
curl -sS https://getcomposer.org/installer | php