PHP
Control Rclone from PHP using the remote control HTTP API with Guzzle.
PHP can interact with Rclone's remote control API using Guzzle, the popular HTTP client, or the built-in cURL functions.
Usage
Using Guzzle:
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'http://localhost:5572/');
echo $response->getBody();Using cURL:
<?php
$ch = curl_init('http://localhost:5572/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Libraries
Flyclone
An object-oriented PHP wrapper for Rclone with progress reporting and fluent API.
composer require verseles/flyclone<?php
use Verseles\Flyclone\Rclone;
use Verseles\Flyclone\Providers\LocalProvider;
use Verseles\Flyclone\Providers\S3Provider;
// List files on local disk
$local = new LocalProvider('myLocalDisk');
$rclone = new Rclone($local);
$files = $rclone->ls('/home/user/documents');
var_dump($files);
// Copy between local and S3
$s3 = new S3Provider('myS3', [
'region' => 'us-east-1',
'access_key_id' => 'YOUR_ACCESS_KEY',
'secret_access_key' => 'YOUR_SECRET_KEY',
]);
$rcloneTransfer = new Rclone($local, $s3);
$rcloneTransfer->copy('/local/path', 'bucket/remote/path');How is this guide?