PHPackages                             projectsaturnstudios/laravel-x-fer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. projectsaturnstudios/laravel-x-fer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

projectsaturnstudios/laravel-x-fer
==================================

Transfer files between servers using SFTP or AWS S3

0.2.3(6mo ago)0163MITPHPPHP ^8.2

Since Jul 8Pushed 6mo agoCompare

[ Source](https://github.com/projectsaturnstudios/laravel-x-fer)[ Packagist](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)[ RSS](/packages/projectsaturnstudios-laravel-x-fer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (7)Used By (0)

Laravel X-Fer
=============

[](#laravel-x-fer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e9d7e9fbd49a46880f753cf1d24bb98209cd1835c87d8d70adf96d58df93d348/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726f6a65637473617475726e73747564696f732f6c61726176656c2d782d6665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)[![Total Downloads](https://camo.githubusercontent.com/8fe8fe396d6b161701d286b4c327a34784d3e951bd0af4651f540f5298772444/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f6a65637473617475726e73747564696f732f6c61726176656c2d782d6665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)[![Code Coverage](https://camo.githubusercontent.com/f0dc19c777f8d64d10e914c6975a41e2372a820db111dc4c5c1a4e86126c9174/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d31342532352d7265642e7376673f7374796c653d666c61742d737175617265)](https://github.com/projectsaturnstudios/laravel-x-fer)[![License](https://camo.githubusercontent.com/a0813b790c806f60f45242ee26899e2f8bd90ae443e1b0334fef96a88b8d05cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70726f6a65637473617475726e73747564696f732f6c61726176656c2d782d6665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)

A simple Laravel package that lets you build streaming file transfers between two defined Laravel filesystem drivers using a factory pattern for one-line transfers. Perfect for ETL processes, data migrations, and cross-server file operations.

Requirements
------------

[](#requirements)

- Laravel 11 or greater
- PHP 8.2 or greater

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require projectsaturnstudios/laravel-x-fer
```

After installation, you can optionally publish the configuration file and migration:

```
php artisan vendor:publish --tag=xfer-config
php artisan vendor:publish --tag=xfer-migrations
```

Run the migrations if you plan to use the logging features:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

After publishing the config file, you can modify `config/file-transfers.php` to customize the batch processing behavior:

```
return [
    /*
    |--------------------------------------------------------------------------
    | File Transfer Batch Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the batch driver that will be used to process file
    | transfers. You may set this to any of the drivers provided by the
    | package or create your own custom driver that implements the
    | ProjectSaturnStudios\Xfer\Contracts\BatchDriver interface.
    |
    | Supported: "sync", "bus", "concurrency", "chain"
    |
    */

    'batch_processing' => [
        'driver' => env('XFER_BATCH_DRIVER', 'sync'),
        'drivers' => [
            'sync' => ProjectSaturnStudios\Xfer\Drivers\BatchProcessing\SyncBatchDriver::class,
            'bus' => ProjectSaturnStudios\Xfer\Drivers\BatchProcessing\BusBatchDriver::class,
            'chain' => ProjectSaturnStudios\Xfer\Drivers\BatchProcessing\ChainBatchDriver::class,
            'concurrency' => ProjectSaturnStudios\Xfer\Drivers\BatchProcessing\ConcurrencyBatchDriver::class,
        ],
    ],

    'folder_associations' => [
        'production' => [
            'sftp' => 'production',
            's3-processed' => 'production/processed',
        ],
        'staging' => [
            'sftp' => 'staging',
            's3-processed' => 'staging/processed',
        ],
        'archive' => [
            'sftp' => 'archive',
            's3-processed' => 'archive/processed',
        ],
    ],
];
```

Usage
-----

[](#usage)

### One-off Transfer

[](#one-off-transfer)

Perform a simple file transfer between two storage disks:

```
use ProjectSaturnStudios\Xfer\Support\Facades\CopyFile;

$copied = CopyFile::from('sftp', 'folder', 'doc.csv')
    ->to('local', 'folder', 'saved-doc.csv')
    ->transfer();
```

### Transfer with Logging

[](#transfer-with-logging)

Add event sourcing and audit trails to your transfers:

```
$results = CopyFile::from('sftp', 'folder', 'doc.csv')
    ->to('local', 'folder', 'saved-doc.csv')
    ->withLogging()
    ->transfer();
```

### Transfer Multiple Files

[](#transfer-multiple-files)

Use batch processing for multiple file transfers:

```
use ProjectSaturnStudios\Xfer\Support\Facades\BatchTransfer;
use ProjectSaturnStudios\Xfer\DTO\Transfers\FileObject;

$batch = BatchTransfer::driver('concurrency');
foreach($transfers as $transfer) {
    $batch = $batch->addTransfer($transfer['source'], $transfer['destination']);
}
$results = $batch->dispatch();
```

### Transfer Multiple Files with Logging

[](#transfer-multiple-files-with-logging)

Combine batch processing with logging:

```
use ProjectSaturnStudios\Xfer\Support\Facades\BatchTransfer;
use ProjectSaturnStudios\Xfer\DTO\Transfers\FileObject;

$batch = BatchTransfer::driver('concurrency');
foreach($transfers as $transfer) {
    $batch = $batch->addTransfer($transfer['source'], $transfer['destination']);
}
$results = $batch->withLogging()->dispatch();
```

Batch Processing Drivers
------------------------

[](#batch-processing-drivers)

Laravel X-Fer provides four built-in batch processing drivers:

### 1. Sync Driver

[](#1-sync-driver)

Processes transfers synchronously (one after another). Best for small batches or when order matters.

### 2. Bus Driver

[](#2-bus-driver)

Uses Laravel's job bus to queue transfers. Ideal for background processing and decoupling from the main request.

### 3. Chain Driver

[](#3-chain-driver)

Chains transfers using Laravel's job chaining. Useful when transfers need to happen in sequence.

### 4. Concurrency Driver

[](#4-concurrency-driver)

Processes transfers concurrently using Laravel 11's new concurrency features. Perfect for large batches where parallel processing improves performance.

### Custom Drivers

[](#custom-drivers)

You can create custom batch drivers by extending the base driver class:

```
use ProjectSaturnStudios\Xfer\Drivers\BatchProcessing\BatchProcessingDriver;

class CustomBatchDriver extends BatchProcessingDriver
{
    public function process(array $items, bool $use_logging = false): array|bool
    {
        // Your custom batch processing logic
        foreach ($items as $item) {
            // Process each transfer
        }

        return $results;
    }
}
```

Register your custom driver in your service provider:

```
use ProjectSaturnStudios\Xfer\Support\Facades\BatchManager;

BatchManager::extend('custom', function ($app) {
    return new CustomBatchDriver();
});
```

Alternatively, after publishing the config file, you can replace any of the built-in drivers in the `batch_processing.drivers` array:

```
'drivers' => [
    'sync' => \App\Drivers\MyCustomSyncDriver::class,
    // ... other drivers
],
```

API Reference
-------------

[](#api-reference)

### CopyFile Facade

[](#copyfile-facade)

#### `from(string $disk, string $folder, string $path): static`

[](#fromstring-disk-string-folder-string-path-static)

Define the source file location.

#### `to(string $disk, string $folder, string $path): static`

[](#tostring-disk-string-folder-string-path-static)

Define the destination file location.

#### `withLogging(bool $enabled = true): static`

[](#withloggingbool-enabled--true-static)

Enable event sourcing and logging for the transfer.

#### `transfer(): bool|TransferResult`

[](#transfer-booltransferresult)

Execute the file transfer. Returns `bool` for simple transfers, `TransferResult` for logged transfers.

### BatchTransfer Facade

[](#batchtransfer-facade)

#### `driver(?string $name = null): static`

[](#driverstring-name--null-static)

Set the batch processing driver.

#### `addTransfer(FileObject $source, FileObject $destination): static`

[](#addtransferfileobject-source-fileobject-destination-static)

Add a transfer to the batch.

#### `addTransfers(array $transfers): static`

[](#addtransfersarray-transfers-static)

Add multiple transfers to the batch.

#### `withLogging(): static`

[](#withlogging-static)

Enable logging for all transfers in the batch.

#### `dispatch(): array|bool`

[](#dispatch-arraybool)

Execute all transfers in the batch.

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Angel Gonzalez](https://github.com/projectsaturnstudios)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Total

6

Last Release

208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2169021b88d520bd58d9a37f51fa55058af7adbf7362c8cade65b261d644874c?d=identicon)[projectsaturnstudios](/maintainers/projectsaturnstudios)

---

Top Contributors

[![projectsaturnstudios](https://avatars.githubusercontent.com/u/10563160?v=4)](https://github.com/projectsaturnstudios "projectsaturnstudios (10 commits)")

---

Tags

filesystemlaravels3sftpfile-transferxfer

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/projectsaturnstudios-laravel-x-fer/health.svg)

```
[![Health](https://phpackages.com/badges/projectsaturnstudios-laravel-x-fer/health.svg)](https://phpackages.com/packages/projectsaturnstudios-laravel-x-fer)
```

###  Alternatives

[spatie/laravel-google-cloud-storage

Google Cloud Storage filesystem driver for Laravel

2408.9M13](/packages/spatie-laravel-google-cloud-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[innoge/laravel-rclone

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

174.1k](/packages/innoge-laravel-rclone)[yoelpc4/laravel-cloudinary

Laravel Cloudinary filesystem cloud driver.

3343.0k](/packages/yoelpc4-laravel-cloudinary)[mwguerra/filemanager

A full-featured file manager package for Laravel and Filament v5 with dual operating modes, drag-and-drop uploads, S3/MinIO support, and comprehensive security features.

718.5k1](/packages/mwguerra-filemanager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
