PHPackages                             ichhabrecht/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ichhabrecht/filesystem

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ichhabrecht/filesystem
======================

Library for advanced filesystem functions

0.4.1(9y ago)01851MITPHP

Since Jun 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/IchHabRecht/filesystem)[ Packagist](https://packagist.org/packages/ichhabrecht/filesystem)[ Docs](https://github.com/IchHabRecht/filesystem)[ RSS](/packages/ichhabrecht-filesystem/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (1)

filesystem
==========

[](#filesystem)

Library for advanced filesystem functions.

[![Latest Stable Version](https://camo.githubusercontent.com/66c217351faf062a21f324415fa6956290a14bb82631492ffd3c15b688f0564d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69636868616272656368742f66696c6573797374656d2e737667)](https://packagist.org/packages/ichhabrecht/filesystem)[![Build Status](https://camo.githubusercontent.com/79ce48750de65407cf2d08fd4db4a5b7918ba1190374f9dae9682ce21f1a3d9e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f49636848616252656368742f66696c6573797374656d2f6d61737465722e737667)](https://travis-ci.org/IchHabRecht/filesystem)

Installation
------------

[](#installation)

It's recommended that you use [Composer](https://getcomposer.org/) to include filesystem in your project.

```
$ composer require ichhabrecht/filesystem
```

Usage
-----

[](#usage)

### Fileidentity

[](#fileidentity)

```
$fileidentity = new \IchHabRecht\Filesystem\Fileidentity();
if (!$fileidentity->canBeValidated('/path/to/file') || $fileidentity->isValid('/path/to/file')) {
    // Do something
}
```

#### canBeValidated

[](#canbevalidated)

Check if the extension of a file has a registered signature in Fileidentity class and so its content can be validated.

#### isValid

[](#isvalid)

Test the first bytes of a file to be valid according to its known signature. If the file does not exist or is not readable an error is thrown. You can use canBeValidated() to ensure the file can be validated.

### Filemode

[](#filemode)

```
$filemode = new \IchHabRecht\Filesystem\Filemode();
$filemode->setPermissions('/path/to/adjust', $settings);
```

#### Settings

[](#settings)

The settings parameter is an array with either a key named `file` or `folder` or both.

You can enforce a hard setting of permissions by using a string value or ensure different permissions by defining them in an array.

```
// This sets file permissions to read and execute (5) and folder permissions to read, write and execute (7)
$settings = [
    'file' => '555',
    'folder' => '777',
];

// This ensures read and write access (6) for files, as well as write and execute access (3) for folders
$settings = [
    'file' => [
        'user' => 6,
        'group' => 6,
        'other' => 6,
    ],
    'folder' => [
        'user' => 3,
        'group' => 3,
        'other' => 3,
    ],
];
```

You can use different permissions for the `user`, `group` and `other` values or just specify the ones you want to ensure.

### Filepath

[](#filepath)

```
$filepath = new \IchHabRecht\Filesystem\Filepath('/', true);
$filepath->concatenate('/var/', 'www', 'vhosts'); // Returns '/var/www/vhosts'
$filepath->ensureDirectorySeparator('C:\\Users\\All Users\\Favorites'); // Returns 'C:/Users/All Users/Favorites'
$filepath->normalize('/var/www/./../../vhosts'); // Returns '/vhosts'
```

#### Initialization

[](#initialization)

If you initialize a new object, you can specify the `directory separator` used for further processing as well as declare if this separator `should be enforced` for given paths. Directory separator can be either slash or backslash.

#### Concatenate

[](#concatenate)

You can pass any number of `string` arguments to this function. All arguments are concatenated with the specified directory separator. Trailing slashes are removed.

#### EnsureDirectorySeparator

[](#ensuredirectoryseparator)

All directory separators (`/` and `\`) are converted into the specified one.

#### Normalize

[](#normalize)

The functions removes doubled (or multiple) directory separators and resolves path traversals.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

Every ~24 days

Total

5

Last Release

3526d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c577dc38578733f324202dc768ced292965740b43a40363ce31003dab833c5e?d=identicon)[IchHabRecht](/maintainers/IchHabRecht)

---

Top Contributors

[![IchHabRecht](https://avatars.githubusercontent.com/u/1453345?v=4)](https://github.com/IchHabRecht "IchHabRecht (20 commits)")

---

Tags

filesystempermissionschmodFilemode

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.4M42](/packages/santigarcor-laratrust)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[jeremykenedy/laravel-roles

A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3 up to 12.

1.0k826.8k6](/packages/jeremykenedy-laravel-roles)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136387.1k](/packages/pktharindu-nova-permissions)

PHPackages © 2026

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