PHP Classes

External Sort: Sort large files similar to the UNIX sort command

Recommend this page to a friend!
  Info   Screenshots   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: 401 All time: 6,563 This week: 455Up
Version License PHP version Categories
external-sort 1.0.0Freely Distributable5Algorithms, PHP 5, Text processing, C...
Description 

Author

This class can sort large files similar to the UNIX sort command.

It can read the file to be sorted in small buckets associated to temporary files to not exceed the configured PHP memory limits.

The buckets are sorted individually and then merged to produce the final sorted output.

The class provides command line interface options so it can be executed as a command from a shell.

Innovation Award
PHP Programming Innovation award nominee
November 2011
Number 7
Sorting data is a relatively easy operation to implement in PHP using the many variants of PHP array sorting functions.

However, if you need to sort large amounts of data, that is not very easy, as it may exceed PHP configured memory limits.

This class implements an approach to sort large files similar to the Unix sort command.

It splits a file to be sorted in multiple chunks of limited size and then merges the sorted results into a final output file.

Manuel Lemos
Picture of Philipp Strazny
  Performance   Level  
Name: Philipp Strazny is available for providing paid consulting. Contact Philipp Strazny .
Classes: 5 packages by
Country: United States United States
Age: 57
All time rank: 1380201 in United States United States
Week rank: 170 Up21 in United States United States Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Screenshots (1)  
  • efficiency_comparison.png
  Files folder image Files (6)  
File Role Description
Plain text file ExternalSort.php Class the external sorting application
Accessible without login HTML file ExternalSort_about.htm Doc. explanations, examples, performance
Accessible without login Plain text file BucketCollectionTest.php Test unit tests for BucketCollection utility class
Accessible without login Plain text file ExternalSortTest.php Test unit tests for ExternalSort
Accessible without login Plain text file License Lic. Academic Free License

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  
 0%
Total:401
This week:0
All time:6,563
This week:455Up