Skip to content

A simple implementation to provide "tail -f" functionality in PHP code. Allows you to monitor newly added lines to a given file.

Notifications You must be signed in to change notification settings

nicodemuz/php-tail-f

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tail -f for PHP

A simple implementation to provide "tail -f" functionality in PHP code. Allows you to monitor newly added lines to a given file.

Works cross-platform on both unix and Windows.

This class is designed for implementation within a PHP daemon, specifically excluding its suitability for PHP scripts that generate output for web browsers.

This is a lightweight class that minimally consumes RAM, CPU, or disk I/O resources. There are no dependencies to other libraries.

Sample usage

<?php

use Nicodemuz\PhpTailF\Monitor;

require 'vendor/autoload.php';

$monitor = new Monitor(
    filePath: '/tmp/test.log',
    sleepMicroseconds: 500000,
);

foreach ($monitor->run() as $output) {
    echo $output;
}

Authors

Credits

Based on the work from https://github.com/Basch3000/php-tail

About

A simple implementation to provide "tail -f" functionality in PHP code. Allows you to monitor newly added lines to a given file.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages