PHPackages                             anteris-dev/file-explorer - 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. anteris-dev/file-explorer

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

anteris-dev/file-explorer
=========================

Bringing a little class to your filesystem operations

v0.1.0(5y ago)01[1 issues](https://github.com/Anteris-Dev/file-explorer/issues)MITPHPPHP ^7.4

Since Sep 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Anteris-Dev/file-explorer)[ Packagist](https://packagist.org/packages/anteris-dev/file-explorer)[ RSS](/packages/anteris-dev-file-explorer/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Bringing a little class to your filesystem operations
=====================================================

[](#bringing-a-little-class-to-your-filesystem-operations)

This package seeks to make your filesystem operations easier by bringing in some easy-to-use verbal methods.

To Install
----------

[](#to-install)

Run `composer require anteris-dev/file-explorer`

**Requirements**

- PHP ^7.4 for stricter type casting.
- [Spatie Data-Transfer-Objects](https://github.com/spatie/data-transfer-object) for file objects.
- [Symfony Filesystem](https://github.com/symfony/filesystem) for their existing easy-to-use functions.

Getting Started
===============

[](#getting-started)

To get started with this package, create a new instance of the `FileExplorer` class. If you pass a directory to the constructor, this will be your starting location, otherwise the current working directory is used.

Example:

```
use Anteris\FileExplorer\FileExplorer;

$fileExplorer = new FileExplorer; // This uses the cwd
$fileExplorer = new FileExplorer('/users/foo'); // This uses /users/foo
```

Interacting with the File System
================================

[](#interacting-with-the-file-system)

There are several methods that will help you to start interacting with the file system. These are listed below.

createDirectory( string $directory )
------------------------------------

[](#createdirectory-string-directory-)

This method creates a new directory. If a relative path, this directory will be created relative to the current pointer. If absolute, it will be created at that location.

Example:

```
$fileExplorer->createDirectory('./myFolder'); // Creates the folder here
$fileExplorer->createDirectory('/users/foo/myFolder'); // Creates the folder in /users/foo
```

createAndEnterDirectory( string $directory )
--------------------------------------------

[](#createandenterdirectory-string-directory-)

Creates a new directory *and* sets the current context to that directory.

Example:

```
use Anteris\FileExplorer\FileExplorer;

$fileExplorer = new FileExplorer('/users/foo');
$fileExplorer->createAndEnterDirectory('testing');
echo $fileExplorer->getCurrentDirectory(); // Returns '/users/foo/testing/'
```

createFile( string $filename, $contents, bool $overwrite = false )
------------------------------------------------------------------

[](#createfile-string-filename-contents-bool-overwrite--false-)

This method creates a new file. If a relative path, this file will be created relative to the current pointer. If absolute, it will be created at that location. Unless $overwrite is passed as true, the file will not be overwritten.

Example:

```
$fileExplorer->createFile('test.txt', 'Hello world!'); // Will not overwrite test.txt
$fileExplorer->createFile('test.txt', 'Hello world!', true); // Will overwrite test.txt
```

enterDirectory( string $directory )
-----------------------------------

[](#enterdirectory-string-directory-)

Sets the current context of the class to this directory (think about entering a sub-folder within your file browser). If a relative path is passed, this is relative to the current directory context.

Example:

```
$fileExplorer->enterDirectory('mySubFolder'); // Relative directory
$fileExplorer->enterDirectory('/users/foo'); // Absolute path
```

exists( string $pointer )
-------------------------

[](#exists-string-pointer-)

Returns true if the requested resource exists, otherwise false. This could be a file or directory. If the path passed is relative, this will be relative to the current directory context.

Example:

```
$fileExplorer->exists('myFolder');
```

getCurrentDirectory()
---------------------

[](#getcurrentdirectory)

Returns the current directory context of the class. This is where relative paths are resolved.

getDirectoryContents()
----------------------

[](#getdirectorycontents)

Returns a collection of files and directories in the current directory context.

Example:

```
use Anteris\FileExplorer\FileObject\Directory;
use Anteris\FileExplorer\FileObject\File;

$items = $fileExplorer->getDirectoryContents();

foreach ($items as $item) {
    if ($item instanceof Directory) {
        echo 'Directory!' . PHP_EOL;
    }

    if ($item instanceof File) {
        echo 'File!' . PHP_EOL;
    }

    echo $file->name . PHP_EOL;
}
```

goUp()
------

[](#goup)

Sets the directory context to the parent folder.

Example:

```
use Anteris\FileExplorer\FileExplorer;

$fileExplorer = new FileExplorer('/users/foo');
$fileExplorer->goUp();

echo $fileExplorer->getCurrentDirectory(); // returns /users/
```

isAbsolutePath(string $path)
----------------------------

[](#isabsolutepathstring-path)

Returns true if the path is absolute, otherwise false.

joinPaths(...$paths)
--------------------

[](#joinpathspaths)

Joins multiple directory paths together. The end is suffixed with a forward slash, so this should not be used with filenames.

Example:

```
/**
 * Returns /users/foo/desktop/
 */
$path = $fileExplorer->joinPaths('/users', '/foo', 'Desktop');
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2083d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dca3c3ac71024f7878526a0fe0a384fbf198ed711fe7e7bb34177a1dbc849f6?d=identicon)[golthem](/maintainers/golthem)

---

Top Contributors

[![aidan-casey](https://avatars.githubusercontent.com/u/6686277?v=4)](https://github.com/aidan-casey "aidan-casey (1 commits)")

---

Tags

directoriesfilesfilesystemphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anteris-dev-file-explorer/health.svg)

```
[![Health](https://phpackages.com/badges/anteris-dev-file-explorer/health.svg)](https://phpackages.com/packages/anteris-dev-file-explorer)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k511.3M2.2k](/packages/aws-aws-sdk-php)[terminal42/contao-fineuploader

FineUploader bundle for Contao Open Source CMS

2052.9k4](/packages/terminal42-contao-fineuploader)

PHPackages © 2026

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