PHPackages                             jakubboucek/php-tail-stream - 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. jakubboucek/php-tail-stream

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

jakubboucek/php-tail-stream
===========================

PHP implementation of linux tail command, optimized for read huge size files, effective memory usage.

v1.0.1(6mo ago)15MITPHPPHP ^8.1CI passing

Since Oct 17Pushed 6mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

PHP Tail Stream
===============

[](#php-tail-stream)

PHP implementation of the Linux `tail` command (display the last part of a file), optimized for reading huge size files with effective memory usage.

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

[](#installation)

You can install the package via Composer:

```
composer require jakubboucek/php-tail-stream
```

and declare namespace:

```
use JakubBoucek\Tail\Tail;
```

Usage
-----

[](#usage)

```
Tail::lines(10)
    ->fromFile('path/to/your/file.txt')
    ->toOutput();

// Output the last 10 lines of the file
```

You can also read data from your stream:

```
$f = fopen('path/to/your/file.txt', 'rb');

Tail::lines(10)
    ->fromStream($f)
    ->toOutput();

// Output the last 10 lines from the stream
```

Note

Source stream MUST allow seeking! You can't use some stream types, like HTTP stream for example.

You can write result to file or another stream, use methods:

```
 - toFile('path/to/your/output.txt'); // Write to file
 - toStream($stream);                 // Write to stream
 - toIterator();                      // Get iterator containting lines as strings
```

Warning

The `toIterator()` method reads the every line to memory. Use it carefully - when you load huge file with very long lines, it can cause memory issues. Be aware especially when you load unknown files, when file doesn't have line separators (e.g. if you accidentally load binary file), whole file will be loaded to memory. To prevent unexpected behavior is method limited to 1 MB of data. You can change this limit by passing the argument `$maxLineSize`.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

206d ago

Major Versions

v0.9.0 → v1.0.02024-12-14

PHP version history (2 changes)v0.9.0PHP ^8.3

v1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/343719dd69717f77bd727d9c3c110aabab0eb24f881dbf05941c1ba0d0deff6c?d=identicon)[jakubboucek](/maintainers/jakubboucek)

---

Top Contributors

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

---

Tags

streamtail

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jakubboucek-php-tail-stream/health.svg)

```
[![Health](https://phpackages.com/badges/jakubboucek-php-tail-stream/health.svg)](https://phpackages.com/packages/jakubboucek-php-tail-stream)
```

###  Alternatives

[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)

PHPackages © 2026

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