PHP Classes

File Pager: Output files split into pages of limited length

Recommend this page to a friend!
  Info   View files Documentation   View files View files (18)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 232 This week: 1All time: 8,129 This week: 560Up
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: 29727 in Armenia Armenia
Week rank: 416 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  
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  /  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  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:232
This week:1
All time:8,129
This week:560Up