mathsgod/flysystem-pcloud

A Flysystem adapter for pCloud storage

1.0.0 2025-06-30 09:37 UTC

This package is auto-updated.

Last update: 2025-06-30 09:38:36 UTC


README

A Flysystem adapter for pCloud, supporting PHP 8+. Usable in Laravel, Symfony, and any PHP project.

Features

  • Upload, download, delete, copy, and move files/folders
  • Stream upload for large files
  • Recursive directory listing
  • Auto-create missing directories
  • Robust error handling

Installation

composer require mathsgod/flysystem-pcloud

Usage

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;
}

Parameters

  • region: 'eu' or 'us', depending on your pCloud account region
  • accessToken: Your pCloud OAuth2 access token

Notes

  • Directory operations will auto-create missing parent folders
  • pCloud API only supports some file attributes; visibility is not supported
  • Any API error will throw an Exception

License

MIT