flow-php/filesystem
Flow Filesystem provides a simple streaming abstraction for local and remote storage. Read files by byte ranges and write in chunks to support large files efficiently. Part of the Flow PHP ecosystem; see docs for installation and usage.
fopen, file_put_contents) or AWS SDKs, reducing vendor lock-in.Illuminate\Contracts\Filesystem\Filesystem), enabling drop-in replacements for core storage adapters (e.g., Storage::disk()).FilesystemInterface (PSR-11 compatible), allowing seamless integration with Laravel’s Illuminate\Filesystem\FilesystemManager.League\Flysystem adapters with Flow\Filesystem\Adapter\S3 for S3 support.Storage::temporaryUrl()).flow-php/telemetry) may require opt-out configuration.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Breaking Changes | Medium | Pin to ^1.0 in composer.json; monitor Flow’s monorepo for updates. |
| Performance Overhead | Low | Benchmark against native PHP/Symfony components. |
| Cloud Provider Quirks | Medium | Test with target providers (e.g., S3 vs. GCS). |
| Telemetry | Low | Disable via FLOW_TELEMETRY=false env var. |
League\Flysystem adapters (e.g., aws, gcs) with Flow\Filesystem\Adapter\* for unified streaming.FilesystemManager::extend() to register Flow adapters alongside existing ones.1MB at a time) to avoid memory issues.FilesystemManager to support Flow adapters.Flow\Filesystem\Filesystem::readRange()/writeChunk().League\Flysystem usages with Flow where streaming is needed.file_get_contents for large files).| Component | Compatibility Notes |
|---|---|
| Laravel 10/11 | ✅ Full support (PHP 8.3+). |
| Symfony Components | ✅ Uses symfony/polyfill-mbstring; no conflicts. |
| AWS/GCP SDKs | ⚠️ Flow wraps SDKs; ensure no version conflicts (e.g., aws/aws-sdk-php). |
| Custom Adapters | ✅ Extend Flow\Filesystem\Adapter\AbstractAdapter for proprietary storage. |
composer require flow-php/filesystem
composer config extra.allow-plugins.flow-php/telemetry false # Disable telemetry
config/filesystems.php):
'disks' => [
'flow_s3' => [
'driver' => 'flow',
'adapter' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'bucket' => 'my-bucket',
],
],
use Flow\Filesystem\Filesystem;
$filesystem = new Filesystem(new Flow\Filesystem\Adapter\S3(...));
$content = $filesystem->readRange('large-file.csv', 0, 1024 * 1024); // Read first 1MB
$filesystem->writeChunk('output.csv', $chunk, 0); // Write chunk at offset 0
composer.json plugins).League\Flysystem as a backup adapter.10GB+ files).Storage::lock()) for critical writes.| Scenario | Impact | Mitigation |
|---|---|---|
| Network Interruption | Partial writes/corrupt files | Use writeChunk with offset tracking + retries. |
| Provider Outage | Unreachable storage | Fallback to local cache (e.g., local disk). |
| Chunk Mismatch | File corruption | Validate checksums post-write. |
| Telemetry Leak | Data privacy concerns | Disable via FLOW_TELEMETRY=false. |
telescope to log file operations for debugging.How can I help you explore Laravel packages today?