PHPackages                             kherge/file - 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. kherge/file

Abandoned → [kherge/file-manager](/?search=kherge%2Ffile-manager)ArchivedLibrary[File &amp; Storage](/categories/file-storage)

kherge/file
===========

An extension of SplFileObject that uses exceptions.

1.3.0(11y ago)52.2k12MITPHPPHP &gt;=5.4

Since Jul 25Pushed 9y agoCompare

[ Source](https://github.com/kherge-archive/php-file)[ Packagist](https://packagist.org/packages/kherge/file)[ RSS](/packages/kherge-file/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (5)Used By (2)

File
====

[](#file)

[![SensioLabsInsight](https://camo.githubusercontent.com/287657d10383758f1e87acbca1d1aaeff296ab491124c80bb9204232157600fc/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63643531626330612d636235632d343164662d623530302d3962653138623938666435642f6d696e692e706e67)](https://insight.sensiolabs.com/projects/cd51bc0a-cb5c-41df-b500-9be18b98fd5d)[![Build Status](https://camo.githubusercontent.com/969c2cb8bbab7d15c2951cc4715c3ef6956773ca7b27a2611e5d2cbd97a11f04/68747470733a2f2f7472617669732d63692e6f72672f6b68657267652d6162616e646f6e65642f7068702d66696c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kherge-abandoned/php-file)[![Latest Stable Version](https://camo.githubusercontent.com/c6a379b5f6514be396a0337ce0d8541fe5f842779d0ba9b9e7b8c1a5b58a078b/68747470733a2f2f706f7365722e707567782e6f72672f6b68657267652f66696c652f762f737461626c652e706e67)](https://packagist.org/packages/kherge/file)[![Latest Unstable Version](https://camo.githubusercontent.com/2fee6f9dd22fbbab01333c9cd13b958e7f03bbb803aa137cbe1b8c3c90a922c7/68747470733a2f2f706f7365722e707567782e6f72672f6b68657267652f66696c652f762f756e737461626c652e706e67)](https://packagist.org/packages/kherge/file)[![Total Downloads](https://camo.githubusercontent.com/79e881ab64e67d5b960b31d68c15aa3f10edeb2261bf29c7d4af300154c14973/68747470733a2f2f706f7365722e707567782e6f72672f6b68657267652f66696c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/kherge/file)

An extension of `SplFileObject` that uses exceptions.

Usage
-----

[](#usage)

You would use this class the exact same way you use `SplFileObject`, because it is `SplFileObject`. The only difference is that errors will throw an exception when they occur.

```
use KHerGe\File\File;

$file = new File('example.txt');
$file->fseek(-1);

/*
 * Fatal error: Uncaught exception 'KHerGe\File\Exception\FileException' with message 'The file "test.txt" could not be seeked.' in /path/to/file/src/lib/KHerGe/File/Exception/FileException.php on line 157
 *
 * KHerGe\File\Exception\FileException: The file "test.txt" could not be seeked. in /path/to/file/src/lib/KHerGe/File/Exception/FileException.php on line 157
 *
 * Call Stack:
 *     0.0001     248992   1. {main}() /path/to/file/test.php:0
 *     0.0011     382928   2. KHerGe\File\File->fseek() /path/to/file/test.php:6
 */
```

> Exceptions originally thrown by `SplFileObject` will also be wrapped in the `FileException` class included with this library.

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

[](#requirements)

- PHP &gt;= 5.4

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

[](#installation)

Via [Composer](http://getcomposer.org/):

```
$ composer require "kherge/file=dev-master"

```

> I recommend that you install the most recent stable release. You can find one on Packagist, the GitHub releases page, or the tag list in the Git repository.

License
-------

[](#license)

This library is available under the [MIT license](LICENSE).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

4028d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

[![kherge](https://avatars.githubusercontent.com/u/9122157?v=4)](https://github.com/kherge "kherge (18 commits)")

---

Tags

exceptionobjectfile

### Embed Badge

![Health badge](/badges/kherge-file/health.svg)

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

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72528.6M91](/packages/knplabs-knp-gaufrette-bundle)[league/flysystem-local

Local filesystem adapter for Flysystem.

226231.8M39](/packages/league-flysystem-local)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)

PHPackages © 2026

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