PHPackages                             wp-php-toolkit/filesystem - 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. wp-php-toolkit/filesystem

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

wp-php-toolkit/filesystem
=========================

Filesystem component for WordPress.

v0.8.1(1mo ago)0119.9k↑98906.7%6GPL-2.0-or-laterPHPPHP &gt;=7.2

Since May 20Pushed 1mo agoCompare

[ Source](https://github.com/wp-php-toolkit/filesystem)[ Packagist](https://packagist.org/packages/wp-php-toolkit/filesystem)[ Docs](https://wordpress.github.io/php-toolkit/reference/filesystem.html)[ RSS](/packages/wp-php-toolkit-filesystem/feed)WikiDiscussions trunk Synced 2d ago

READMEChangelogDependencies (6)Versions (49)Used By (6)

   slug filesystem   title Filesystem   install wp-php-toolkit/filesystem   see\_also    bytestream | ByteStream | Open files as readers and writers instead of loading full strings.

 zip | Zip | Mount archives and copy data between archive-backed and normal filesystems.

 git | Git | Expose repository trees through a filesystem-shaped API.

    One `Filesystem` interface across local disk, in-memory trees, SQLite databases, and ZIP archives. Forward-slash paths everywhere — even on Windows — so the same code runs in tests, in production, and inside read-only ZIP-backed trees.

Why this exists
---------------

[](#why-this-exists)

Code that touches the filesystem is hard to test, hard to port to Windows, and impossible to point at non-disk storage without rewriting it. Swap `LocalFilesystem` for `InMemoryFilesystem` in tests and your suite stops touching `/tmp`; swap it for `SQLiteFilesystem` when the `sqlite3` extension is available and your "files" become rows in a portable database; swap it for `ZipFilesystem` and you can read inside an archive with the same calls.

Every backend uses forward slashes regardless of host OS. No `DIRECTORY_SEPARATOR` juggling, no Windows-only test failures, no surprises when a path moves between backends.

In-memory tree
--------------

[](#in-memory-tree)

The fastest backend. No disk I/O, no cleanup, no test-isolation problems.

```
