Flysystem Path Prefixing

A Flysystem adapter decorator that transparently prefixes every path with a fixed root.

Library
Composer
v3.31.0
2stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
16/100Needs Attention
Development Activity4
Maintenance0
Community8
Maturity52
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture75
Code Quality80
Innovation55
Learning Curve92

Flysystem Path Prefixing is a small adapter decorator for League Flysystem that transparently prepends a fixed path prefix to every filesystem operation. You wrap any existing Flysystem adapter, give it a base directory, and all reads, writes, listings, and deletes are scoped beneath that prefix without changing the calling code. It is the official way to confine a filesystem to a subdirectory or to run multiple logically separated stores on top of a single underlying adapter.

What You Get

  • A PathPrefixedAdapter that wraps any Flysystem v3 adapter and applies a fixed prefix to all paths
  • Transparent prefixing across the full filesystem API — read, write, list, move, copy, and delete
  • A drop-in way to sandbox or namespace storage without touching your application’s file-access code

Common Use Cases

  • Confining a filesystem to a specific subdirectory so callers cannot escape a base path
  • Running several logically isolated stores on top of one shared underlying adapter
  • Adding a tenant- or environment-specific root prefix to an existing storage configuration

Under The Hood

Architecture - The package provides a single PathPrefixedAdapter that implements Flysystem’s FilesystemAdapter interface and delegates to an inner adapter. It uses Flysystem’s PathPrefixer to join the configured prefix with each incoming path on the way in and to strip it from listings on the way out, so both directions of the API stay consistent. Tech Stack - Written for PHP 8.0.2+ and depends only on league/flysystem (^3.10). It uses PSR-4 autoloading under the League\Flysystem\PathPrefixing namespace and is distributed as a read-only subtree split of the main Flysystem monorepo. Code Quality - Despite its small size, the adapter ships with a PathPrefixedAdapterTest covering the decorated operations, and it follows the same coding standards and CI as the rest of the League Flysystem project. API Design - Usage is a single constructor call — new PathPrefixedAdapter($innerAdapter, 'some/prefix') — after which the wrapped filesystem behaves identically to any other, keeping the abstraction invisible to the rest of the codebase.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search