PHP code example of osw3 / php-cloud-manager

1. Go to this page and download the library: Download osw3/php-cloud-manager 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/ */

    

osw3 / php-cloud-manager example snippets

 
$dsn = "{$driver}://{$user}:{$pass}@{$host}";

use OSW3\CloudManager\Client;
$client = new Client($dsn);
 
$client = new Client($dsn, false);
$client->connect();

    $client->dsn()->getDriver(); // ftp
    

    $client->dsn()->getDriver(); // ftp
    

    $client->dsn()->getHost(); // site.com
    

    $client->dsn()->getUser(); // user
    

    $client->dsn()->getPass(); // pass
    

    $client->dsn()->getAuth();
    

    $client->dsn()->getToken();
    

    $client->dsn()->getPort(); // 21
    

    $client->dsn()->get(); // ftp://user:[email protected]";
    

    $client->connect();
    

    $client->disconnect();
    

    $client->isConnected();
    

    $client->setTempDirectory("my/temp/dir");
    

    $client->getTempDirectory();
    

    $client->location();
    

    $client->navigateTo("/www");
    

    $client->parent();
    

    $client->root();
    

    $client->infos("/www/my-dir"); // [...]
    $client->infos("/www/my-dir", "type"); // folder
    

    $client->isFolder("/www/my-dir");
    

    $client->isDirectory("/www/my-dir");
    

    $client->isFile("/www/my-dir");
    

    $client->isLink("/www/my-dir");
    

    $client->isBlock("/www/my-dir");
    

    $client->isCharacter("/www/my-dir");
    

    $client->isSocket("/www/my-dir");
    

    $client->isPipe("/www/my-dir");
    

    $client->permissions("/www/my-dir", 0777); // true
    $client->permissions("/www/my-dir"); // 0777
    

    $client->setPermission("/www/my-dir", 0777);
    

    $client->getPermission("/www/my-dir"); // 0777
    
 
    $client->browse("/www/my-dir"); // [...]
    
 
    $client->createFolder("/www/my-dir/my-sub-dir");
    
 
    $client->deleteFolder("/www/my-dir/my-sub-dir");
    
 
    $client->duplicateFolder("/www/my-dir", "/www/my-other-dirt");
    
 
    $client->moveFolder("C://my-dir", "/www/my-dir");
    
 
    $client->uploadFolder("C://my-dir", "/www/my-dir");
    
 
    $client->downloadFolder("/www/my-dir", "C://my-dir");
    
 
    $client->createFile("/www/my-dir/my-file.txt", "Hi!\This is my file.");
    
 
    $client->deleteFile("/www/my-dir/my-file.txt");
    
 
    $client->duplicateFile("/www/my-dir/my-file.txt", "/www/my-other-dir/my-file.txt");
    
 
    $client->moveFile("C://my-dir/my-file.txt", "/www/my-dir/my-file.txt");
    
 
    $client->uploadFile("C://my-dir/my-file.txt", "/www/my-dir/my-file.txt");
    
 
    $client->downloadFile("/www/my-dir/my-file.txt", "C://my-dir/my-file.txt");
    
 
    $client->delete("/www/my-dir/my-file.txt");
    $client->delete("/www/my-dir");
    
 
    $client->duplicate("/www/my-dir/my-file.txt", "/www/my-sub-dir/my-file.txt");
    $client->duplicate("/www/my-dir", "/www/my-sub-dir");
    
 
    $client->move("/www/my-dir/my-file.txt", "/www/my-sub-dir/my-file.txt");
    $client->move("/www/my-dir", "/www/my-sub-dir");
    
 
    $client->upload("C://my-dir", "/www/my-dir");
    $client->upload("C://my-dir/my-file.txt", "/www/my-dir/my-file.txt");
    
 
    $client->download("/www/my-dir", "C://my-dir");
    $client->download("/www/my-dir/my-file.txt", "C://my-dir/my-file.txt");
    
shell
composer