PHPackages                             mobileka/liner - 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. mobileka/liner

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

mobileka/liner
==============

Liner is a simple file reader

1.1.0(9y ago)78681MITPHPPHP &gt;=5.4.0

Since Oct 1Pushed 9y agoCompare

[ Source](https://github.com/mobileka/liner)[ Packagist](https://packagist.org/packages/mobileka/liner)[ RSS](/packages/mobileka-liner/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/2a1abfbf8d859193f2e1377661b69a480e2e74c39419b7197e13a701aad48080/68747470733a2f2f7472617669732d63692e6f72672f6d6f62696c656b612f6c696e65722e737667)](https://travis-ci.org/mobileka/liner)[![Code Climate](https://camo.githubusercontent.com/2ff20571d472e3c698313285ed6ed38dcf14ea2bd4628af035f3910c46ac665c/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d6f62696c656b612f6c696e65722e737667)](https://codeclimate.com/github/mobileka/liner)[![Coverage Status](https://camo.githubusercontent.com/34151ff6a7ded57206641c858978e8ead4ca1368c02a43271a8b82de302dc3dd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6d6f62696c656b612f6c696e65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/mobileka/liner?branch=master)

Liner is a fast and dead simple file reader which allows reading files line by line.

It has been tested with a number of huge files including those with more than 5 million rows and proved itself as a fast and efficient file reader.

Requires PHP 5.4 or newer.

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

[](#installation)

`composer require mobileka/liner:1.1.*`

And sometimes I find myself looking for this line in installation section:

`"mobileka/liner": "1.1.*"`

Usage
-----

[](#usage)

```
$liner = new Liner('path/to/a/file'); // or SplFileObject instance

// Read the whole file
$liner->read();

// Only the first line
$liner->read(1);

// Only the second line
$liner->read(1, 1);

// Read 100 lines starting with the 6th line
$liner->read(100, 5);

// You can also pass a closure as a third argument to mutate the result without iterating over it
// Here's how you can read a CSV file:
$csvAsArray = $liner->read(0, 0, function($file, $line) {
    $line = trim($line);
    return explode(',', $line);
});

// A line will be ignored if modifier returns null
$anEmptyArray = $liner->read(0, 0, function($file, $line) {
    return null;
});

// almost forgot to mention that you can get the number of lines
$liner->getNumberOfLines();

// and that you can also delegate methods to SplFileObject (is it a good idea though?)
$liner->eof();
$liner->rewind();
```

License
-------

[](#license)

Liner is an open-source software and licensed under the [MIT License](https://github.com/mobileka/liner/blob/master/license).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

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

Total

4

Last Release

3519d ago

### Community

Maintainers

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

---

Top Contributors

[![mobileka](https://avatars.githubusercontent.com/u/1132388?v=4)](https://github.com/mobileka "mobileka (11 commits)")

---

Tags

filereaderlimitoffset

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mobileka-liner/health.svg)

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

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k665.7M2.4k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k277.8M959](/packages/league-flysystem-aws-s3-v3)[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k40.9M129](/packages/knplabs-gaufrette)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72429.6M99](/packages/knplabs-knp-gaufrette-bundle)[league/flysystem-local

Local filesystem adapter for Flysystem.

224254.9M71](/packages/league-flysystem-local)[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8535.9M247](/packages/league-flysystem-memory)

PHPackages © 2026

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