PHPackages                             rkwadriga/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. [File &amp; Storage](/categories/file-storage)
4. /
5. rkwadriga/php-filereader

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

rkwadriga/php-filereader
========================

PHP file reader

023PHP

Since Sep 9Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

PHP files reader
----------------

[](#php-files-reader)

REQUIREMENTS
------------

[](#requirements)

The minimum requirement by this application template that your Web server supports PHP 7.4.0.

Install
-------

[](#install)

```
$ composer require rkwadriga/php-filereader:dev-master
```

### Supported formats: csv, sql, txt, log, json, yml, yaml

[](#supported-formats-csv-sql-txt-log-json-yml-yaml)

Usage
-----

[](#usage)

```
use rkwadriga\filereader\Factory;

class MyApp
{
    public function myFunction()
    {
        // Create a Factory instance
        $factory = new Factory();
        // Create file reader (in this case .yml file reader)
        $fileReader = $factory->getReader('./config/main.yml');

        // Read file (method "readFile" returns an associative array)
        $data = $fileReader->read();

        // Write file
        $fileReader->write([
            'var1' => 'Value 1',
            'var2' => 'Value 2',
        ]);
    }
}
```

If you use the same dir for all files you work with, you can put this dir in Factory constructor and use relative files paths:

```
$factory = new Factory('./files_dir_path');
$fileReader = $factory->getReader('main.yml');
```

The file readers automatically crete file if it's not exist. If you don't want to do this, set second argument of "getReader" method to false:

```
$fileReader = $factory->getReader('main.yml', false);
```

In this case you will get the "File not found" exception trying to read not existed file.

If you have some specific file extension but that can be read like one of allowed extensions, you can set the "extensions map" of the readers factory:

```
$factory = new Factory(null, [
    'xjson' => 'json',
    'xtxt' => 'txt',
    ...
]);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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.

### Community

Maintainers

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

### Embed Badge

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

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

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