PHPackages                             gmi/toolkit-fileinfo - 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. gmi/toolkit-fileinfo

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

gmi/toolkit-fileinfo
====================

File information component

1.1.6(5y ago)137LGPL-3.0-onlyPHPPHP &gt;=5.6.0CI failing

Since Feb 7Pushed 3y ago4 watchersCompare

[ Source](https://github.com/gmitirol/toolkit-fileinfo)[ Packagist](https://packagist.org/packages/gmi/toolkit-fileinfo)[ Docs](https://github.com/gmitirol/toolkit-fileinfo)[ RSS](/packages/gmi-toolkit-fileinfo/feed)WikiDiscussions main Synced 2mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

PHP Toolkit - Fileinfo
======================

[](#php-toolkit---fileinfo)

This library provides features to read file information.

It provides an abstraction layer above SplFileInfo for consistent behavior and easier usage.

- Ability to retrieve the file name without its extension
- Human-readable file sizes
- Usage of `DateTime` objects instead of Unix timestamps
- Ability to retrieve the file owner/group (via posix\_\* functions)
- Human-readable permissions

File information is read during construction of the FileInfo instance or when `FileInfo::reload()` is called.

For easier dependency injection in projects, a simple `FileInfoFactory` is provided.

The current build status and code analysis can be found here:

- [Scrutinizer CI](https://scrutinizer-ci.com/g/gmitirol/toolkit-fileinfo/)

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

[](#requirements)

- PHP 5.6.0 or higher
- PHP mbstring extension
- PHP posix extension

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

[](#installation)

The recommended way to install toolkit-fileinfo is via composer.

```
"require": {
    "gmi/toolkit-fileinfo": "1.1.*"
}
```

Usage examples
--------------

[](#usage-examples)

```
use Gmi\Toolkit\Fileinfo\FileInfo;

$fileInfo = new FileInfo('/path/to/awesome.pdf');

/**
 * Get information about file path:
 * @see Gmi\Toolkit\Fileinfo\Part\PathInfo
 */

$fileInfo->path()->getPath();
// '/path/to'

$fileInfo->path()->getFilename();
// 'awesome.pdf'

$fileInfo->path()->getFilenameWithoutExtension();
// 'awesome'

$fileInfo->path()->getExtension();
// 'pdf'

/**
 * Get information about file size:
 * @see Gmi\Toolkit\Fileinfo\Part\SizeInfo
 */

$fileInfo->size()->getSize();
// 34703

$fileInfo->size()->getSizeFormatted();
// '33.89 KiB'

/**
 * Get information about file dates:
 * @see Gmi\Toolkit\Fileinfo\Part\DateInfo
 */

$fileInfo->date()->getLastAccessed();
// object(DateTime)

$fileInfo->date()->getLastModified();
// object(DateTime)

/**
 * Get information about file permissions:
 * @see Gmi\Toolkit\Fileinfo\Part\PermissionInfo
 */

$fileInfo->perm()->getOwner();
// 0

$fileInfo->perm()->getOwnerName();
// 'root'

$fileInfo->perm()->getPermsFormatted();
// 'rw-r--r--'

/**
 * Get information about file type:
 * @see Gmi\Toolkit\Fileinfo\Part\TypeInfo
 */

$fileInfo->type()->getMimeType();
// 'application/pdf'

/**
 * Reload file information:
 */
$fileInfo->reload();
```

Tests
-----

[](#tests)

The test suite can be run with `vendor/bin/phpunit tests`. Tests are insulated by using a temporary directory per test.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~137 days

Recently: every ~186 days

Total

9

Last Release

1921d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6316e9c35db774eda1f74aa8629e0cda915df7eec254f7b90929ae5049ca1fa0?d=identicon)[andaris](/maintainers/andaris)

![](https://www.gravatar.com/avatar/36e5a70419b45d8c6e57b00e9320911100daeed76818ecbc11eaf35e21115487?d=identicon)[gmi](/maintainers/gmi)

---

Top Contributors

[![xelan](https://avatars.githubusercontent.com/u/5080535?v=4)](https://github.com/xelan "xelan (23 commits)")

---

Tags

fileinfomime-typesphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gmi-toolkit-fileinfo/health.svg)

```
[![Health](https://phpackages.com/badges/gmi-toolkit-fileinfo/health.svg)](https://phpackages.com/packages/gmi-toolkit-fileinfo)
```

###  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)
