This package is abandoned and no longer maintained. The author suggests using the symfony/finder package instead.

A fluent API for navigating a local file system.

0.7.1 2021-10-16 17:19 UTC

This package is auto-updated.

Last update: 2022-05-23 17:40:59 UTC


File System is for manipulating a local file system.

The primary interface is designed to simplify traversing fully-qualified paths. The secondary interface allows for reading, writing, and listing items based on the path.

Each path is represented by an instance of the Item class.


{how does one install the product}


Let's say we had the following folder structure:

├── 8fold/
│   └── Desktop/
│       ├── app/
│       │   ├── Models/
│       │   │   └── Main.php
│       │   └── Providers
│       ├── data/
│       │   └── target.md
│       ├── routes/
│       │   └── web.php
│       ├── vendor
│       └── .env
└── Josh

Let's say we wanted to get the content of the target.md file from within the Main.php class.


use Eightfold\FileSystem\FileSystem;


  public function targetContent(): string
	return Item::create(__DIR__)
      ->up(2)->append('data', 'target.md')


The path given to the create static initializer sets a starting point. We use the up and append methods to move from that starting point. The FileSystem class is relatively immutable, which means the up and append methods do not modify the initial path stored by the instance; rather, they return a new instance with the new path.

The content method returns the content of a file or a list of files, folders, or both within a directory.

Terminal methods begin with verbs and determiners such as is, does, and the; methods considered to be fluent, such as up and append have no prefix.


Many of the 8fold sites under development use a simple flat-file system for storing content and data. We wanted something that fit in with the surronding code and, as usual, an interface that we could use throughout our code to reduce coupling directly to Flysystem from the league of extraordinary packages.


{links or descriptions or license, versioning, and governance}