PHP Classes

File Pager: Output files split into pages of limited length

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 232 All time: 8,135 This week: 455Up
Version License PHP version Categories
file-pager 1.0.0Custom (specified...5PHP 5, Files and Folders
Description 

Author

This package can output files split into pages of limited length.

It can read the text lines of a given file and output the file lines split into pages of a limited number of lines per page.

The class can add line numbers in the beginning of each line, as well display the page number and the file path at the bottom of each page.

Innovation Award
PHP Programming Innovation award nominee
March 2017
Number 5
Pagination is useful to split listings of long information into multiple pages. It is often used to split database query results into a list of Web pages.

This package can paginate an arbitrary text into a list of pages of limited line length suited to display on console terminal.

Manuel Lemos
Picture of Edgar Asatryan
Name: Edgar Asatryan <contact>
Classes: 4 packages by
Country: Armenia Armenia
Age: ???
All time rank: 29787 in Armenia Armenia
Week rank: 178 Up2 in Armenia Armenia Up
Innovation award
Innovation award
Nominee: 1x

Documentation

file-pager

This is a simple extension is written in PHP intended to divide a file into pages.

Installation

$ composer require nstdio/file-pager: "dev-master"

or add

"nstdio/file-pager": "dev-master"

to the require section of your composer.json file.

Usage

<?php
use nstdio\FilePager;

$fileName = "path/to/file";
$pageSize = 25; // lines count on page.

$pager = new FilePager($fileName, $pageSize);
$pager->setLineSeparator(LineSeparator::HTML); // All control characters will be trimmed out.

$pager->prependLine('#{line}') // prepend string to line. Available tokens {line}, {pageLine}, {path}, {file}, {dir}, {page}.
      ->append("{page}.");

echp $pager->getPage(1);

  Files folder image Files (18)  
File Role Description
Files folder imagesrc (9 files)
Files folder imagetests (6 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (18)  /  src  
File Role Description
  Plain text file Cache.php Class Class source
  Plain text file CacheItem.php Class Class source
  Plain text file CorruptedDataException.php Class Class source
  Plain text file File.php Class Class source
  Plain text file FilePager.php Class Class source
  Plain text file Handler.php Class Class source
  Plain text file LineSeparator.php Class Class source
  Plain text file Output.php Class Class source
  Plain text file OutputInterface.php Class Class source

  Files folder image Files (18)  /  tests  
File Role Description
  Plain text file ClosureAsOutputHandlerTest.php Class Class source
  Plain text file FileSystemTest.php Class Class source
  Plain text file MockFile.php Class Class source
  Plain text file OutputTest.php Class Class source
  Plain text file PageSizeTest.php Class Class source
  Accessible without login Plain text file phpunit.xml Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:232
This week:0
All time:8,135
This week:455Up