innoge/laravel-rclone

A sleek PHP wrapper around rclone with Laravel-style fluent API syntax

Maintainers

๐Ÿ‘ geisi

Package info

github.com/InnoGE/laravel-rclone

Homepage

pkg:composer/innoge/laravel-rclone

Fund package maintenance!

InnoGE

Statistics

Installs: 6โ€‰571

Dependents: 0

Suggesters: 0

Stars: 17

Open Issues: 0

v1.1.0 2026-02-27 11:56 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ab75e4dd7b9477e950b2cbe07d4f6662f987050b

  • Daniel Seuffer <authanram.woop@users.noreply.github.com>

filesystemstorages3synccloudbackupsftpftprclonelaravel-style

This package is auto-updated.

Last update: 2026-06-11 13:49:34 UTC


README

A sleek Laravel package that wraps rclone with an elegant, fluent API syntax.

๐Ÿ‘ PHP Version
๐Ÿ‘ Laravel Version
๐Ÿ‘ Test Coverage
๐Ÿ‘ Total Downloads

โœจ Features

  • ๐ŸŽฏ Fluent API - Laravel-style method chaining
  • ๐Ÿš€ Driver Agnostic - Local, S3, SFTP, FTP support
  • โšก Zero Configuration - Uses Laravel filesystem config
  • ๐Ÿ”ง Highly Configurable - Override any rclone option
  • ๐Ÿ“Š Progress Tracking - Real-time callbacks & stats
  • ๐Ÿงช 100% Test Coverage - Battle-tested with Pest
  • ๐Ÿ—๏ธ Laravel Native - Service Provider, Facade, Auto-Discovery

๐Ÿš€ Quick Start

Install via Composer:

composer require innoge/laravel-rclone

Basic usage:

use InnoGE\LaravelRclone\Facades\Rclone;

// Simple sync
Rclone::source('s3', 'documents')
 ->target('backup', 'archive')
 ->sync();

// With progress & options
Rclone::source('s3', 'media/photos')
 ->target('local', 'storage/backups')
 ->withProgress()
 ->transfers(16)
 ->checkers(8)
 ->getOutputUsing(fn($type, $output) => Log::info("Rclone: {$output}"))
 ->sync();

๐Ÿ“‹ Requirements

โš™๏ธ Configuration

The package automatically uses your existing config/filesystems.php configuration:

// config/filesystems.php
'disks' => [
 's3' => [
 'driver' => 's3',
 'key' => env('AWS_ACCESS_KEY_ID'),
 'secret' => env('AWS_SECRET_ACCESS_KEY'),
 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
 'bucket' => env('AWS_BUCKET'),
 ],
 'sftp' => [
 'driver' => 'sftp',
 'host' => env('SFTP_HOST'),
 'username' => env('SFTP_USERNAME'),
 'password' => env('SFTP_PASSWORD'),
 'port' => env('SFTP_PORT', 22),
 ],
]

Optional: Publish config for advanced settings:

php artisan vendor:publish --provider="InnoGE\LaravelRclone\RcloneServiceProvider" --tag="rclone-config"

๐ŸŽฏ API Reference

Core Operations

// Sync (make target identical to source)
$result = Rclone::source('s3', 'data')->target('backup')->sync();

// Copy (don't delete from target)
$result = Rclone::source('s3', 'data')->target('backup')->copy();

// Move (delete from source after transfer)
$result = Rclone::source('s3', 'data')->target('backup')->move();

Performance Tuning

Rclone::source('s3', 'large-dataset')
 ->target('backup', 'archive')
 ->transfers(32) // Parallel transfers
 ->checkers(16) // File checkers
 ->retries(5) // Retry attempts
 ->statInterval(10) // Stats interval (seconds)
 ->option('bandwidth', '50M') // Custom rclone option
 ->sync();

Progress Monitoring

$result = Rclone::source('s3', 'files')
 ->target('local', 'backup')
 ->withProgress()
 ->getOutputUsing(function ($type, $output) {
 if ($type === 'out') {
 echo "Progress: {$output}";
 } else {
 Log::error("Rclone Error: {$output}");
 }
 })
 ->sync();

// Check results
if ($result->isSuccessful()) {
 $stats = $result->getStats();
 echo "Transferred: {$stats['transferred_files']} files\n";
 echo "Data: {$stats['transferred_bytes']} bytes\n";
} else {
 echo "Failed: {$result->getErrorOutput()}\n";
}

๐Ÿ”Œ Supported Storage Providers

Provider Driver Required Config
Local Filesystem local root
Amazon S3 s3 key, secret, region, bucket
SFTP sftp host, username, password/key_file
FTP ftp host, username, password

S3 Configuration

's3' => [
 'driver' => 's3',
 'key' => 'AKIAIOSFODNN7EXAMPLE',
 'secret' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
 'region' => 'us-west-2',
 'bucket' => 'my-bucket',
 'endpoint' => 'https://s3.amazonaws.com', // Optional
 'use_path_style_endpoint' => false, // Optional
]

SFTP Authentication

'sftp' => [
 'driver' => 'sftp',
 'host' => 'server.example.com',
 'username' => 'user',
 // Password auth
 'password' => 'secret',
 // OR Key file auth
 'key_file' => '/path/to/private/key',
 // OR Inline key auth
 'private_key' => '-----BEGIN OPENSSH PRIVATE KEY-----...',
 'port' => 22,
]

๐Ÿ—๏ธ Laravel Integration

Dependency Injection

use InnoGE\LaravelRclone\Contracts\RcloneInterface;

class BackupService
{
 public function __construct(
 private RcloneInterface $rclone
 ) {}

 public function dailyBackup(): bool
 {
 $result = $this->rclone
 ->source('local', 'app/data')
 ->target('s3', 'backups/daily')
 ->withProgress()
 ->sync();

 return $result->isSuccessful();
 }
}

Artisan Command Example

use InnoGE\LaravelRclone\Facades\Rclone;

class BackupCommand extends Command
{
 public function handle(): int
 {
 $this->info('Starting backup...');

 $result = Rclone::source('local', 'storage/app')
 ->target('s3', 'backups/' . now()->format('Y-m-d'))
 ->withProgress()
 ->getOutputUsing(fn($type, $output) => $this->line($output))
 ->sync();

 return $result->isSuccessful() ? 0 : 1;
 }
}

๐Ÿ› ๏ธ Advanced Configuration

Environment variables:

RCLONE_BINARY_PATH=/usr/local/bin/rclone
RCLONE_TIMEOUT=7200

Custom config file (config/rclone.php):

return [
 'binary_path' => env('RCLONE_BINARY_PATH', 'rclone'),
 'timeout' => env('RCLONE_TIMEOUT', 3600),
 'base_options' => [
 '--delete-after',
 '--fast-list',
 '--checksum',
 ],
 'defaults' => [
 'transfers' => 4,
 'checkers' => 8,
 'retries' => 3,
 'progress' => false,
 ],
];

๐Ÿงช Testing

# Run tests
composer test

# With coverage
composer test-coverage

# Static analysis
composer analyse

# Format code
composer format

๐Ÿค Contributing

Contributions welcome! Please submit issues and pull requests on GitHub.

๐Ÿ’ Built With Love

This package was crafted with passion by amazing developers:

๐Ÿ“„ License

MIT License. See LICENSE for details.

โšก Powered by rclone - The Swiss Army knife of cloud storage