PHPackages                             ravjanisz/filesystemstructure - 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. ravjanisz/filesystemstructure

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

ravjanisz/filesystemstructure
=============================

filesystemstructure

10PHPCI failing

Since Oct 27Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ravjanisz/filesystemstructure)[ Packagist](https://packagist.org/packages/ravjanisz/filesystemstructure)[ RSS](/packages/ravjanisz-filesystemstructure/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

filesystemstructure
===================

[](#filesystemstructure)

[![Build Status](https://camo.githubusercontent.com/01d99d3d97a602a7d3173120f76d27945c42bfda307695186517dc9a1a9ebb11/68747470733a2f2f7472617669732d63692e6f72672f7261766a616e69737a2f66696c6573797374656d7374727563747572652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ravjanisz/filesystemstructure)[![codecov](https://camo.githubusercontent.com/9362b1debc2dc957fa4a44f737dd691d83143d61501284ad7221b9e415b8fa87/68747470733a2f2f636f6465636f762e696f2f67682f7261766a616e69737a2f66696c6573797374656d7374727563747572652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ravjanisz/filesystemstructure)

List you directory structure as a objects tree. Exclude directories from list. Filter by directory or file. Order by name (default - structure), type, time and size.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- ravjanisz/objectsize
- (optional) PHPUnit to run tests.

Install
-------

[](#install)

Via Composer:

```
$ composer require ravjanisz/filesystemstructure
```

Usage
-----

[](#usage)

```
use Rav\FileSystem\Structure\Structure;

//create new structure
$structure = new Structure();

//exclude object from structure
$structure
    ->hide('full_path_file_or_directory');

//exclude objects from structure
$structure
    ->hide(['full_path_file_or_directory1', 'full_path_file_or_directory2']);

//list only directories or files, or both
$structure
    ->filter(Structure::FILTER_DIR);
$structure
    ->filter(Structure::FILTER_FILE);
$structure
    ->filter(Structure::FILTER_ALL);

//order by size - get folders and files order by their size
//return array of object - Rav\FileSystem\Structure\FsObject -flat
//can by ordered ascending and descending
$structure
    ->order(Structure::ORDER_SIZE, Structure::ORDER_VALUE_DESC);
$structure
    ->order(Structure::ORDER_SIZE, Structure::ORDER_VALUE_ASC);

//order by time - get folders and files order by their modified time
//return array of object - Rav\FileSystem\Structure\FsObject -flat
//can by ordered ascending and descending
$structure
    ->order(Structure::ORDER_TIME, Structure::ORDER_VALUE_DESC);
$structure
    ->order(Structure::ORDER_TIME, Structure::ORDER_VALUE_ASC);

//order by type - get folders and files order by their filetype
//return array of object - Rav\FileSystem\Structure\FsObject -flat
//can by ordered ascending and descending
$structure
    ->order(Structure::ORDER_TYPE, Structure::ORDER_VALUE_DESC);
$structure
    ->order(Structure::ORDER_TYPE, Structure::ORDER_VALUE_ASC);

//order by name - get whole directory structure
//return object - Rav\FileSystem\Structure\FsObject - tree
//can by ordered ascending and descending
$structure
    ->order(Structure::ORDER_NAME, Structure::ORDER_VALUE_DESC);
$structure
    ->order(Structure::ORDER_NAME, Structure::ORDER_VALUE_ASC);

$path = __DIR__ . '/files';
$outputStructure = $structure->get($path);

//get first element for order by: time, type and size or object tree for order by name

//get object type
echo $outputStructure->getType();
//get object full path
echo $outputStructure->getPath();
//get file/directory name
echo $outputStructure->getName();
//get size in bytes
echo $outputStructure->getSize();
//get timestamp
echo $outputStructure->getTime();
//get human readable size
echo $outputStructure->humanSize();
//get human readable time
echo $outputStructure->humanTime();
//check if object has childes
echo $outputStructure->hasChildes();
//get objects array - Rav\FileSystem\Structure\FsObject - tree
//only for order by name
echo $outputStructure->getChildes();
```

Documentation
-------------

[](#documentation)

None

Support the development
-----------------------

[](#support-the-development)

**Do you like this project? Support it by donating**

[![alt Buy me a coffee](https://raw.githubusercontent.com/ravjanisz/filesystemstructure/master/docs/assets/bmc.png)](https://www.buymeacoffee.com/ravjanisz)License
-------

[](#license)

filesystemstructure is licensed under the MIT License - see the LICENSE file for details

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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://avatars.githubusercontent.com/u/28200514?v=4)[Rafał Janisz](/maintainers/ravjanisz)[@ravjanisz](https://github.com/ravjanisz)

---

Top Contributors

[![ravjanisz](https://avatars.githubusercontent.com/u/28200514?v=4)](https://github.com/ravjanisz "ravjanisz (8 commits)")

### Embed Badge

![Health badge](/badges/ravjanisz-filesystemstructure/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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