PHP code example of mathsgod / flysystem-pcloud
1. Go to this page and download the library: Download mathsgod/flysystem-pcloud 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/ */
mathsgod / flysystem-pcloud example snippets
use League\Flysystem\Filesystem;
use League\Flysystem\pCloud\pCloudAdapter;
$adapter = new pCloudAdapter(
region: 'eu', // or 'us'
accessToken: 'your-access-token'
);
$filesystem = new Filesystem($adapter);
// Upload a file
$filesystem->write('/folder/file.txt', 'content');
// Read a file
$content = $filesystem->read('/folder/file.txt');
// List directory contents
foreach ($filesystem->listContents('/folder', true) as $item) {
echo $item->path() . PHP_EOL;
}