PHPackages                             chillerlan/php-filereader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. chillerlan/php-filereader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chillerlan/php-filereader
=========================

A simple filereader. PHP 7.2+

2.0.0(7y ago)53.4k11MITPHPPHP ^7.2

Since Mar 6Pushed 7y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

chillerlan/php-filereader
=========================

[](#chillerlanphp-filereader)

A simple file/directory reader for all (well, most... ok. some.) of your file-reading needs.

[![version](https://camo.githubusercontent.com/ab49174fd92506a1a7f6225dc4d3d755e2b5f165a6ce2c6015f1bdeab2876656/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chillerlan/php-filereader)[![license](https://camo.githubusercontent.com/a88d7eb2d6bad6b0fa712d9dca111f0810196ddf1de49206416c2fdeeaca1fb7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/chillerlan/php-filereader/blob/master/LICENSE)[![Travis](https://camo.githubusercontent.com/5dccf896a41a2cd7b3c177d09992e52345e34e8620aadab29e20cec5b66a133a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/chillerlan/php-filereader)[![Coverage](https://camo.githubusercontent.com/2a72ec978c967197b38e75e16f5bf8612805e74f300c9f427fe126c0c1ceb7fe/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/chillerlan/php-filereader)[![Scrunitizer](https://camo.githubusercontent.com/c512b668560dd4671b02dbee11001f1bd981106462dade02576e064418ed96c5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/chillerlan/php-filereader)[![Packagist downloads](https://camo.githubusercontent.com/4f8a9a27d278978ad7e98d0a91c4597498197f9b4815b32d4c278fc2b68436ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368696c6c65726c616e2f7068702d66696c657265616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chillerlan/database/stats)[![PayPal donate](https://camo.githubusercontent.com/1898364bc025197736eadf98f27b48ed82c6c63b9ba33e201eaae5cbde03ae42/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d6666333361612e7376673f7374796c653d666c61742d737175617265)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WLYUNAT9ZTJZ4)

Requirements
============

[](#requirements)

- PHP 7.2+

Documentation
=============

[](#documentation)

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

[](#installation)

**requires [composer](https://getcomposer.org)**

### *composer.json*

[](#composerjson)

(note: replace `dev-master` with a [version boundary](https://getcomposer.org/doc/articles/versions.md#summary))

```
{
	"require": {
		"php": ">=7.2.0",
		"chillerlan/database": "dev-master"
	}
}
```

### Manual installation

[](#manual-installation)

Download the desired version of the package from [master](https://github.com/chillerlan/php-filereader/archive/master.zip) or [release](https://github.com/chillerlan/php-filereader/releases) and extract the contents to your project folder. After that:

- run `composer install` to install the required dependencies and generate `/vendor/autoload.php`.
- if you use a custom autoloader, point the namespace `chillerlan\Filereader` to the folder `src` of the package

Profit!

Usage
-----

[](#usage)

### simple

[](#simple)

You can just invoke one a `FSDriverInterface` and use it right away:

```
use chillerlan\Filereader\Drivers\DiskDriver;

$filereader = new DiskDriver;
$filereader->isDir('/some/path');
```

### advanced

[](#advanced)

```
$directory = new Directory($filereader, '/some/path');

/** @var \chillerlan\Filereader\File $file */
foreach($directory->read() as $file){
	echo $file->name;
	// ...
}
```

API
---

[](#api)

### `FSDriverInterface` methods

[](#fsdriverinterface-methods)

methodreturn`fileExists(string $path)`bool`isFile(string $path)`bool`fileContents(string $path)`string`getRequire(string $path)`mixed`deleteFile(string $path)`bool`copyFile(string $source, string $destination, bool $overwrite = true)`bool`isDir(string $path)`bool`makeDir(string $path)`bool`deleteDir(string $path)`bool`rename(string $oldname, string $newname, bool $overwrite = true)`bool### `Directory` public methods

[](#directory-public-methods)

methodreturn`__construct(FSDriverInterface $driver, string $path)`-`change(string $path)``Directory``read()`array of `File` objects`create(string $subdir = null)`bool`delete(string $subdir = null)`bool`rename(string $newname, bool $overwrite = true)``Directory`### `File` public methods

[](#file-public-methods)

methodreturn`__construct(FSDriverInterface $driver, Directory $directory, string $name)`-`exists()`bool`content()`string`getRequire()`mixed`copy(string $destination, bool $overwrite = true)`bool`rename(string $newname, bool $overwrite = true)``File``delete()`bool### common magic properties of `Directory` and `File`

[](#common-magic-properties-of-directory-and-file)

propertytypedescription`$path`stringthe full path to the resource### additional magic properties of `File`

[](#additional-magic-properties-of-file)

propertytypedescription`$name`stringthe basename of the file`$directory``Directory`the `Directory` which contains the file

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

2630d ago

Major Versions

1.0.1 → 2.0.02019-03-06

PHP version history (2 changes)1.0.0PHP &gt;=7.0.3

2.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ada3d048807a11e536645fb87da881170b18f34c0c61fa09e34807c5d79e0b89?d=identicon)[codemasher](/maintainers/codemasher)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chillerlan-php-filereader/health.svg)

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

###  Alternatives

[myxtype/eos-client

php eos client offline sign eosphp-ecc

462.1k](/packages/myxtype-eos-client)

PHPackages © 2026

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