PHPackages                             sacred/flysystem-lazy-migration-adapter - 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. sacred/flysystem-lazy-migration-adapter

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

sacred/flysystem-lazy-migration-adapter
=======================================

A Flysystem adapter that lazily migrates files from an old adapter to a new one as they are accessed.

v1.0.1(5mo ago)2132↓50%MITPHPPHP &gt;=7.4CI passing

Since Dec 15Pushed 5mo agoCompare

[ Source](https://github.com/antonsacred/flysystem-lazy-migration-adapter)[ Packagist](https://packagist.org/packages/sacred/flysystem-lazy-migration-adapter)[ RSS](/packages/sacred-flysystem-lazy-migration-adapter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (0)

Flysystem Lazy Migration Adapter
================================

[](#flysystem-lazy-migration-adapter)

`sacred/flysystem-lazy-migration-adapter` provides a small Flysystem adapter wrapper that moves files from an old adapter to a new one the first time they are accessed. Reads, writes, deletes, and metadata calls automatically migrate the underlying file so you can cut over storage backends without a coordinated bulk move.

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

[](#installation)

```
composer require sacred/flysystem-lazy-migration-adapter
```

Supports PHP 7.4+ and both Flysystem v2 and v3 (`league/flysystem` `^2.0 || ^3.0`).

Usage
-----

[](#usage)

Wrap your existing adapters and start using the wrapper everywhere you would normally use a `FilesystemAdapter`. Files encountered on the old adapter will be copied to the new one and removed from the old location on first access.

```
use Sacred\Flysystem\LazyMigrationAdapter;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;

$oldAdapter = new LocalFilesystemAdapter('/mnt/old-storage');
$newAdapter = new LocalFilesystemAdapter('/mnt/new-storage');

$migratingAdapter = new LazyMigrationAdapter($oldAdapter, $newAdapter);
$filesystem = new Filesystem($migratingAdapter);

// The first read migrates the file to the new adapter transparently.
$contents = $filesystem->read('path/to/file.txt');
```

### How it works

[](#how-it-works)

- Each operation checks the old adapter first. If a file exists there and not on the new adapter, it is streamed over to the new adapter and deleted from the old one.
- If a file exists on both, the copy on the old adapter is removed and the new adapter is used for the operation.
- Directory creation always targets the new adapter; deletes target both when applicable.

Testing
-------

[](#testing)

```
composer install
composer test
```

The GitHub Actions workflow runs the test suite against Flysystem v2 on PHP 7.4+ and Flysystem v3 on PHP 8.2+.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance73

Regular maintenance activity

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

154d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ca0d6e4d988ccf5ee64842dbc073af8bb83e160b2372897e21275c1c6b37150?d=identicon)[antonsacred](/maintainers/antonsacred)

---

Top Contributors

[![antonsacred](https://avatars.githubusercontent.com/u/57615458?v=4)](https://github.com/antonsacred "antonsacred (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sacred-flysystem-lazy-migration-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/sacred-flysystem-lazy-migration-adapter/health.svg)](https://phpackages.com/packages/sacred-flysystem-lazy-migration-adapter)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[league/flysystem-local

Local filesystem adapter for Flysystem.

225231.8M39](/packages/league-flysystem-local)[league/flysystem-bundle

Symfony bundle integrating Flysystem into Symfony applications

40129.5M87](/packages/league-flysystem-bundle)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)

PHPackages © 2026

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