PHP Classes

PHP RLE Compression Algorithm: Compress and decompress data using RLE in pure PHP

Recommend this page to a friend!
     
  Info   Example   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: 237 All time: 8,067 This week: 38Up
Version License PHP version Categories
rle 0.1Free for non-comm...5.0PHP 5, Compression
Description 

Author

This class can compress and decompress data using RLE in pure PHP.

It can take a string of data and compress it with the Run Length Encoding algorithm.

The class can also do the opposite, i.e. decode previously compressed data with the same algorithm.

Innovation Award
PHP Programming Innovation award nominee
December 2014
Number 5


Prize: One copy of the Zend Studio
RLE (Run-Level Encoding) is a simple compression algorithm that compresses data that has many repeated symbols.

This class provides a pure PHP implementation of the REL compression algorith to compress and decompress data.

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 33922 in France France
Week rank: 197 Up10 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x

Example

<?php
/*
* Copyright (c) 2014 Chi Hoang
* All rights reserved
*/
require_once("main.php");

$obj = new Compress\Rle("aaaabbcc","Encode");
$obj->start();
echo
$obj;
$obj->start("aabbcccccccccccde");
echo
$obj;

$obj = new Compress\Rle("a4b2c2","Decode");
$obj->start();
echo
$obj;

$obj = new Compress\Rle("aabb","Decode");
$obj->start();
echo
$obj;

$obj = new Compress\Rle("aabbccde","Encode");
$obj->start();
echo
$obj;

$obj = new Compress\Rle("aabbccdeaaaaaaaaaaaaaaae","Encode");
$obj->start();
echo
$obj;




?>


  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file compressTest.php Test Unit Test
Accessible without login Plain text file example.php Example example script
Plain text file main.php Class main class

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:237
This week:0
All time:8,067
This week:38Up