{"id":34639878,"url":"https://github.com/projectsaturnstudios/laravel-x-fer","last_synced_at":"2026-01-20T16:48:21.496Z","repository":{"id":303649700,"uuid":"1016239105","full_name":"projectsaturnstudios/laravel-x-fer","owner":"projectsaturnstudios","description":"Transfer files between servers using SFTP or AWS S3","archived":false,"fork":false,"pushed_at":"2025-10-22T19:52:53.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-22T21:36:32.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projectsaturnstudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-08T17:42:24.000Z","updated_at":"2025-10-22T19:52:53.000Z","dependencies_parsed_at":"2025-07-08T18:45:14.151Z","dependency_job_id":"d51cb8ed-930f-47aa-b00c-e1e28cb936cb","html_url":"https://github.com/projectsaturnstudios/laravel-x-fer","commit_stats":null,"previous_names":["projectsaturnstudios/laravel-x-fer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/projectsaturnstudios/laravel-x-fer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Flaravel-x-fer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Flaravel-x-fer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Flaravel-x-fer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Flaravel-x-fer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectsaturnstudios","download_url":"https://codeload.github.com/projectsaturnstudios/laravel-x-fer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Flaravel-x-fer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28005414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T17:15:42.249Z","updated_at":"2025-12-24T17:15:47.146Z","avatar_url":"https://github.com/projectsaturnstudios.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel X-Fer\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/projectsaturnstudios/laravel-x-fer.svg?style=flat-square)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)\n[![Total Downloads](https://img.shields.io/packagist/dt/projectsaturnstudios/laravel-x-fer.svg?style=flat-square)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)\n[![Code Coverage](https://img.shields.io/badge/coverage-14%25-red.svg?style=flat-square)](https://github.com/projectsaturnstudios/laravel-x-fer)\n[![License](https://img.shields.io/packagist/l/projectsaturnstudios/laravel-x-fer.svg?style=flat-square)](https://packagist.org/packages/projectsaturnstudios/laravel-x-fer)\n\u003c!-- [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/projectsaturnstudios/laravel-x-fer/run-tests.yml?branch=main\u0026label=Tests)](https://github.com/projectsaturnstudios/laravel-x-fer/actions/workflows/run-tests.yml) --\u003e\n\nA 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.\n\n## Requirements\n\n- Laravel 11 or greater\n- PHP 8.2 or greater\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require projectsaturnstudios/laravel-x-fer\n```\n\nAfter installation, you can optionally publish the configuration file and migration:\n\n```bash\nphp artisan vendor:publish --tag=xfer-config\nphp artisan vendor:publish --tag=xfer-migrations\n```\n\nRun the migrations if you plan to use the logging features:\n\n```bash\nphp artisan migrate\n```\n\n## Configuration\n\nAfter publishing the config file, you can modify `config/file-transfers.php` to customize the batch processing behavior:\n\n```php\nreturn [\n    /*\n    |--------------------------------------------------------------------------\n    | File Transfer Batch Driver\n    |--------------------------------------------------------------------------\n    |\n    | This option controls the batch driver that will be used to process file\n    | transfers. You may set this to any of the drivers provided by the\n    | package or create your own custom driver that implements the\n    | ProjectSaturnStudios\\Xfer\\Contracts\\BatchDriver interface.\n    |\n    | Supported: \"sync\", \"bus\", \"concurrency\", \"chain\"\n    |\n    */\n\n    'batch_processing' =\u003e [\n        'driver' =\u003e env('XFER_BATCH_DRIVER', 'sync'),\n        'drivers' =\u003e [\n            'sync' =\u003e ProjectSaturnStudios\\Xfer\\Drivers\\BatchProcessing\\SyncBatchDriver::class,\n            'bus' =\u003e ProjectSaturnStudios\\Xfer\\Drivers\\BatchProcessing\\BusBatchDriver::class,\n            'chain' =\u003e ProjectSaturnStudios\\Xfer\\Drivers\\BatchProcessing\\ChainBatchDriver::class,\n            'concurrency' =\u003e ProjectSaturnStudios\\Xfer\\Drivers\\BatchProcessing\\ConcurrencyBatchDriver::class,\n        ],\n    ],\n\n    'folder_associations' =\u003e [\n        'production' =\u003e [\n            'sftp' =\u003e 'production',\n            's3-processed' =\u003e 'production/processed',\n        ],\n        'staging' =\u003e [\n            'sftp' =\u003e 'staging',\n            's3-processed' =\u003e 'staging/processed',\n        ],\n        'archive' =\u003e [\n            'sftp' =\u003e 'archive',\n            's3-processed' =\u003e 'archive/processed',\n        ],\n    ],\n];\n```\n\n## Usage\n\n### One-off Transfer\n\nPerform a simple file transfer between two storage disks:\n\n```php\nuse ProjectSaturnStudios\\Xfer\\Support\\Facades\\CopyFile;\n\n$copied = CopyFile::from('sftp', 'folder', 'doc.csv')\n    -\u003eto('local', 'folder', 'saved-doc.csv')\n    -\u003etransfer();\n```\n\n### Transfer with Logging\n\nAdd event sourcing and audit trails to your transfers:\n\n```php\n$results = CopyFile::from('sftp', 'folder', 'doc.csv')\n    -\u003eto('local', 'folder', 'saved-doc.csv')\n    -\u003ewithLogging()\n    -\u003etransfer();\n```\n\n### Transfer Multiple Files\n\nUse batch processing for multiple file transfers:\n\n```php\nuse ProjectSaturnStudios\\Xfer\\Support\\Facades\\BatchTransfer;\nuse ProjectSaturnStudios\\Xfer\\DTO\\Transfers\\FileObject;\n\n$batch = BatchTransfer::driver('concurrency');\nforeach($transfers as $transfer) {\n    $batch = $batch-\u003eaddTransfer($transfer['source'], $transfer['destination']);\n}\n$results = $batch-\u003edispatch();\n```\n\n### Transfer Multiple Files with Logging\n\nCombine batch processing with logging:\n\n```php\nuse ProjectSaturnStudios\\Xfer\\Support\\Facades\\BatchTransfer;\nuse ProjectSaturnStudios\\Xfer\\DTO\\Transfers\\FileObject;\n\n$batch = BatchTransfer::driver('concurrency');\nforeach($transfers as $transfer) {\n    $batch = $batch-\u003eaddTransfer($transfer['source'], $transfer['destination']);\n}\n$results = $batch-\u003ewithLogging()-\u003edispatch();\n```\n\n## Batch Processing Drivers\n\nLaravel X-Fer provides four built-in batch processing drivers:\n\n### 1. Sync Driver\nProcesses transfers synchronously (one after another). Best for small batches or when order matters.\n\n### 2. Bus Driver\nUses Laravel's job bus to queue transfers. Ideal for background processing and decoupling from the main request.\n\n### 3. Chain Driver\nChains transfers using Laravel's job chaining. Useful when transfers need to happen in sequence.\n\n### 4. Concurrency Driver\nProcesses transfers concurrently using Laravel 11's new concurrency features. Perfect for large batches where parallel processing improves performance.\n\n### Custom Drivers\n\nYou can create custom batch drivers by extending the base driver class:\n\n```php\nuse ProjectSaturnStudios\\Xfer\\Drivers\\BatchProcessing\\BatchProcessingDriver;\n\nclass CustomBatchDriver extends BatchProcessingDriver\n{\n    public function process(array $items, bool $use_logging = false): array|bool\n    {\n        // Your custom batch processing logic\n        foreach ($items as $item) {\n            // Process each transfer\n        }\n\n        return $results;\n    }\n}\n```\n\nRegister your custom driver in your service provider:\n\n```php\nuse ProjectSaturnStudios\\Xfer\\Support\\Facades\\BatchManager;\n\nBatchManager::extend('custom', function ($app) {\n    return new CustomBatchDriver();\n});\n```\n\nAlternatively, after publishing the config file, you can replace any of the built-in drivers in the `batch_processing.drivers` array:\n\n```php\n'drivers' =\u003e [\n    'sync' =\u003e \\App\\Drivers\\MyCustomSyncDriver::class,\n    // ... other drivers\n],\n```\n\n## API Reference\n\n### CopyFile Facade\n\n#### `from(string $disk, string $folder, string $path): static`\nDefine the source file location.\n\n#### `to(string $disk, string $folder, string $path): static`\nDefine the destination file location.\n\n#### `withLogging(bool $enabled = true): static`\nEnable event sourcing and logging for the transfer.\n\n#### `transfer(): bool|TransferResult`\nExecute the file transfer. Returns `bool` for simple transfers, `TransferResult` for logged transfers.\n\n### BatchTransfer Facade\n\n#### `driver(?string $name = null): static`\nSet the batch processing driver.\n\n#### `addTransfer(FileObject $source, FileObject $destination): static`\nAdd a transfer to the batch.\n\n#### `addTransfers(array $transfers): static`\nAdd multiple transfers to the batch.\n\n#### `withLogging(): static`\nEnable logging for all transfers in the batch.\n\n#### `dispatch(): array|bool`\nExecute all transfers in the batch.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Credits\n\n- [Angel Gonzalez](https://github.com/projectsaturnstudios)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectsaturnstudios%2Flaravel-x-fer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectsaturnstudios%2Flaravel-x-fer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectsaturnstudios%2Flaravel-x-fer/lists"}