explaingit

thephpleague/flysystem

13,565PHPAudience · developerComplexity · 2/5Setup · easy

TLDR

Flysystem is a PHP library that gives your app one consistent API for reading, writing, and managing files regardless of whether they live on local disk, Amazon S3, Google Cloud, FTP, SFTP, or other storage backends.

Mindmap

mindmap
  root((repo))
    What it does
      Unified file API
      Swap storage backends
      Test without disk
    Official adapters
      Local disk
      Amazon S3
      Google Cloud
      SFTP and FTP
    Community adapters
      Azure Blob
      Dropbox
      Google Drive
    Audience
      PHP developers
      Web app builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Swap file storage from local disk in development to Amazon S3 in production by changing one configuration line.

USE CASE 2

Test file-handling code with an in-memory adapter so no real disk or network is touched during test runs.

USE CASE 3

Build a multi-cloud storage layer so your app can use S3, Google Cloud, and Azure without duplicating file logic.

USE CASE 4

Manage user file uploads via SFTP, WebDAV, or ZIP archive backends using the same application code.

Tech stack

PHP

Getting it running

Difficulty · easy Time to first run · 30min

In plain English

Flysystem is a PHP library that gives you one consistent programming interface for working with files stored in different locations. Whether your files live on the local disk, on a remote FTP or SFTP server, in Amazon S3, in Google Cloud Storage, in MongoDB's GridFS, or in several other storage systems, your application code looks the same. You call the same methods to read, write, copy, list, and delete files regardless of where they are physically stored. The main benefit is that you can swap the storage backend without changing the file-handling code throughout your application. A project that stores files locally during development can use S3 in production, or change cloud providers later, by updating one configuration line rather than rewriting file operations across the codebase. This also makes it simpler to test file-related code, because the in-memory adapter lets you run tests without touching a real disk or network. The library ships with officially supported adapters for local disk, FTP, SFTP, in-memory storage, AWS S3, AsyncAws S3, Google Cloud Storage, MongoDB GridFS, WebDAV, and ZIP archives. A broader set of community-maintained adapters covers Azure Blob Storage, Dropbox, OneDrive, Google Drive, Bunny CDN, Uploadcare, and others. The library's adapter interface is open, so you can also write a custom one for any storage system not already covered. The current major version is V3, and a migration guide is available for projects upgrading from earlier versions. The library requires PHP 8.0.2 or newer. The README is concise and primarily points to the official documentation site, which covers the full API, architecture details, how to build a custom adapter, and upgrade guidance.

Copy-paste prompts

Prompt 1
Using Flysystem V3 in PHP, write code to upload a file to Amazon S3 and then list all files in the bucket.
Prompt 2
Show me how to configure Flysystem so I use a local disk adapter in development and an S3 adapter in production with no code changes.
Prompt 3
Write a PHP script that uses Flysystem to copy all files from local disk to Google Cloud Storage.
Prompt 4
How do I write a custom Flysystem adapter for a storage backend not already supported by the library?
Prompt 5
Using Flysystem's in-memory adapter, write PHP unit tests for a class that reads and writes files without touching real storage.
Open on GitHub → Explain another repo

← thephpleague on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.