PHPackages                             liamrabe/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. liamrabe/filesystem

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

liamrabe/filesystem
===================

Easy-to-use filesystem-class

15PHP

Since Oct 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/liamrabe/Filesystem)[ Packagist](https://packagist.org/packages/liamrabe/filesystem)[ RSS](/packages/liamrabe-filesystem/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Filesystem
==========

[](#filesystem)

An easy-to-use filesystem-class for PHP 8.0 and above.

Installation
============

[](#installation)

Run `composer require liamrabe/filesystem` to add it to your project

Requirements
============

[](#requirements)

- PHP &gt;=8.0
- SimpleXML &amp; JSON
- Composer 2

Usage
=====

[](#usage)

`liamrabe/Filesystem` uses function-chaining so you just need to initialize it with the `path()`-function, like this:

```
$file = Filesystem::path('/path/to/file');
```

Functions
---------

[](#functions)

### getContent() (string)

[](#getcontent-string)

Returns the file's content.

```
$file->getContent(); // Returns: Lorem ipsum dolor sit amet.
```

### setContent() (Filesystem)

[](#setcontent-filesystem)

Sets the file's content.

```
$file->setContent('Hello, world'); // Returns: itself.
```

### exists() (bool)

[](#exists-bool)

Returns `true` or `false` depending on if the file exists or not.

```
$file->exists(); // Returns: true or false
```

### setMode(int $mode) \[protected\]

[](#setmodeint-mode-protected)

Changes the filesystem "mode" to either `read` or `write`.

```
// This sets the filesystem mode to write
$this->setMode(Filesystem::MODE_WRITE);
```

### getMetadata() (FileInformation)

[](#getmetadata-fileinformation)

Initializes `FileInformation`-class with metadata about the file.

#### getDirname() (string)

[](#getdirname-string)

Returns current file's directory path.

#### getFileName() (string)

[](#getfilename-string)

Returns the filename of the current file.

#### getLastModified() (int)

[](#getlastmodified-int)

Returns the unix timestamp when the file was last modified.

#### getFileType() (string)

[](#getfiletype-string)

Returns the filetype.

#### getFullPath() (string)

[](#getfullpath-string)

Returns the full path to the file.

Function chaining
-----------------

[](#function-chaining)

You can use function-chaining to get parts of a file or metadata.

Here's an example using function-chaining and string format.

```
use liamrabe\Filesystem;

require "./vendor/autoload.php";

$dirname = '/path/to/file';
$filename = 'file.txt';

echo Filesystem::path('/%s/%s', $dirname, $filename)
        ->getMetadata()
            ->getDirname();

// Returns: '/path/to/file'
```

Issues
------

[](#issues)

If you've found an issue or want to request a feature, create an issue or make a pull request and I'll check it out when I can.

License
-------

[](#license)

MIT

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f67d2198f3880668d0ad7c985196ee069bf7936820b5415ccaa4672e7129de8d?d=identicon)[liamrabe](/maintainers/liamrabe)

---

Top Contributors

[![liamrabe](https://avatars.githubusercontent.com/u/28879732?v=4)](https://github.com/liamrabe "liamrabe (16 commits)")

### Embed Badge

![Health badge](/badges/liamrabe-filesystem/health.svg)

```
[![Health](https://phpackages.com/badges/liamrabe-filesystem/health.svg)](https://phpackages.com/packages/liamrabe-filesystem)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
