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

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

hugsbrugs/php-filesystem
========================

PHP File System Utilities

02241PHPCI failing

Since May 25Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (1)

php-filesystem
==============

[](#php-filesystem)

This librairy is a set of functions to ease filesystem operations and manipulations

[![Build Status](https://camo.githubusercontent.com/f60f590dc5349a1a8a93e3ddf009cf7990957943c76918b4d9f5089061bd3f7f/68747470733a2f2f7472617669732d63692e6f72672f6875677362727567732f7068702d66696c6573797374656d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugsbrugs/php-filesystem)

[![Coverage Status](https://camo.githubusercontent.com/a0af5baeb0df433f204e8f03a3b2ad80c95f0fc3753c53b3e76a71c75708b39e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875677362727567732f7068702d66696c6573797374656d2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hugsbrugs/php-filesystem?branch=master)

Install
-------

[](#install)

Install package with composer

```
composer require hugsbrugs/php-filesystem

```

In your PHP code, load librairy

```
require_once __DIR__ . '/../vendor/autoload.php';
use Hug\FileSystem\FileSystem as FileSystem;

```

Usage
-----

[](#usage)

List files in a directory optionnaly filter by extension (. and .. are removed from response)

```
FileSystem::scandir_h($directory, $file_extension = null);
```

Remove files recursively in a directory

```
FileSystem::rrmdir($dir, $del_dir = TRUE);
```

Recursively copy files and folder to destination and creates directory structure if necessary

```
FileSystem::rcopy($source, $dest, $permissions = 0755);
```

Writes data in a file and creates directories if necessary

```
FileSystem::force_file_put_contents($filename, $data, $flags = 0, $context = null);
```

List files in a directory with options

```
FileSystem::list_dir($dir, $return_type = 'ALL', $return_format = 'FULL');
```

Get file last modification date in desired date format

```
FileSystem::file_last_mod($file_path, $date_format = 'Y-m-d H:i:s');
```

Get file size

```
FileSystem::file_size($FilePath);
```

Get bunch of informations about file list

```
FileSystem::get_file_list_infos($files);
```

Get a human readable file size

```
FileSystem::human_file_size($size, $unit = '');
```

Converts a file size in bytes in a human readable way

```
FileSystem::get_symbol_by_quantity($bytes);
```

Get a directory size

```
FileSystem::dir_size($directory);
```

Get disk usage

```
FileSystem::get_disk_usage($path);
```

Delete files in a directory older than a given date

```
FileSystem::remove_older_files($directory, $date_interval = 'P8D', $get_results = false, $test_mode = false);
```

Compares two files for eqality

```
FileSystem::are_files_equal($file_a, $file_b);
```

Get unix file permissions

```
FileSystem::unix_file_permissions($path);
```

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

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/cc04033020c3e5219ac30edf7d7362952e88ea64a0de2f41b89559f849f09901?d=identicon)[hugsbrugs](/maintainers/hugsbrugs)

---

Top Contributors

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

---

Tags

filesystemphpphp-filesystem

### Embed Badge

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

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

PHPackages © 2026

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