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

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

lkt/file-reader
===============

A simple file reader. PHP 8.1+

1.0.0(3y ago)01671MITPHPPHP ^8.1

Since Dec 16Pushed 3y agoCompare

[ Source](https://github.com/lkt-php/lkt-file-reader)[ Packagist](https://packagist.org/packages/lkt/file-reader)[ Docs](https://github.com/lkt/lkt-file-reader)[ RSS](/packages/lkt-file-reader/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

lkt/file-reader
===============

[](#lktfile-reader)

This is a fork of [chillerlan/php-filereader](https://github.com/chillerlan/php-filereader).

It was forked as soon I realize chillerlan/php-filereader last update was 4 years ago.

I like this package, and now supports php 8.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 8.1+

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

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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

Unknown

Total

1

Last Release

1295d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/456537?v=4)[Gediminas Aleknavičius](/maintainers/lkt)[@lkt](https://github.com/lkt)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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