Skip to content

Rayne/ecoji-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

33 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Ecoji for PHP ๐Ÿฃ๐Ÿ”‰๐Ÿฆ๐Ÿ”ผ๐Ÿ‰๐Ÿ”น๐Ÿฆ’๐Ÿ“ฒ๐Ÿ’๐Ÿ๐Ÿ€„โ˜•

Ecoji encodes data as 1024 emojis. It's like base1024 with an emoji character set. Visit ecoji.io to try Ecoji in your browser.

rayne/ecoji is a PHP port of Ecoji with 100% test coverage.

Latest Stable Version Code Coverage Scrutinizer Code Quality License

Contents

Installation

composer require rayne/ecoji

Encoding

use Rayne\Ecoji\Ecoji;

$ecoji = new Ecoji;
$ecoji->encode("Base64 is so 1999, isn\'t there something better?\n");
๐Ÿ—๐Ÿ“ฉ๐ŸŽฆ๐Ÿ‡๐ŸŽ›๐Ÿ“˜๐Ÿ”ฏ๐Ÿšœ๐Ÿ’ž๐Ÿ˜ฝ๐Ÿ†–๐ŸŠ๐ŸŽฑ๐Ÿฅ๐Ÿš„๐ŸŒฑ๐Ÿ’ž๐Ÿ˜ญ๐Ÿ’ฎ๐Ÿ‡ต๐Ÿ’ข๐Ÿ•ฅ๐Ÿญ๐Ÿ”ธ๐Ÿ‰๐Ÿšฒ๐Ÿฆ‘๐Ÿถ๐Ÿ’ข๐Ÿ•ฅ๐Ÿ”ฎ๐Ÿ”บ๐Ÿ‰๐Ÿ“ธ๐Ÿฎ๐ŸŒผ๐Ÿ‘ฆ๐ŸšŸ๐Ÿฅด๐Ÿ“‘

Decoding

use Rayne\Ecoji\Ecoji;

$ecoji = new Ecoji;
$ecoji->decode('๐Ÿ—๐Ÿ“ฉ๐ŸŽฆ๐Ÿ‡๐ŸŽ›๐Ÿ“˜๐Ÿ”ฏ๐Ÿšœ๐Ÿ’ž๐Ÿ˜ฝ๐Ÿ†–๐ŸŠ๐ŸŽฑ๐Ÿฅ๐Ÿš„๐ŸŒฑ๐Ÿ’ž๐Ÿ˜ญ๐Ÿ’ฎ๐Ÿ‡ต๐Ÿ’ข๐Ÿ•ฅ๐Ÿญ๐Ÿ”ธ๐Ÿ‰๐Ÿšฒ๐Ÿฆ‘๐Ÿถ๐Ÿ’ข๐Ÿ•ฅ๐Ÿ”ฎ๐Ÿ”บ๐Ÿ‰๐Ÿ“ธ๐Ÿฎ๐ŸŒผ๐Ÿ‘ฆ๐ŸšŸ๐Ÿฅด๐Ÿ“‘');
Base64 is so 1999, isn't there something better?

Streams

use Rayne\Ecoji\Ecoji;

$ecoji = new EcojiStream;
$ecoji->encode($sourceStream, $destinationStream);
$ecoji->decode($sourceStream, $destinationStream);

EcojiStream doesn't wrap the encoded stream without configuring the wrap length first. A value of 0 disables wrapping.

use Rayne\Ecoji\Ecoji;

$ecoji = new EcojiStream;
$ecoji->setWrap(80);

CLI

The CLI encodes and decodes files and streams.

./bin/ecoji --help
Usage: ecoji [OPTIONS]... [FILE]

Encode or decode data as Unicode emojis. ๐Ÿ˜

Options:
    -d, --decode          Decode data.
    -w, --wrap COLS       Wrap encoded lines after COLS characters (default 76).
                          Use 0 to disable line wrapping.
    -h, --help            Print this message.
    -v, --version         Print version information.

Installing the Composer package rayne/ecoji will create a symlink, e.g. vendor/bin/ecoji.

Docker

Launch a temporary Ecoji Docker container to utilize the CLI:

docker run -it --rm rayne/ecoji --help

Pipe data through a container:

echo -n "Ecoji for Docker" | docker run -i --rm rayne/ecoji
๐Ÿฃ๐Ÿ”‰๐Ÿฆ๐Ÿ”ผ๐Ÿ‰๐Ÿ”น๐Ÿฆ’๐Ÿ“ฒ๐ŸŸ๐Ÿ™๐ŸŽง๐Ÿค’๐Ÿ’™โ˜•โ˜•โ˜•

Encode or decode a file by mounting it as volume or piping its content through a container:

docker run -it --rm -v /my/message:/file rayne/ecoji /file
cat /my/message | docker run -i --rm rayne/ecoji

Docker Images

The docker/README.md explains how to build the application and all optional development images for all supported PHP versions. Additional convenience scripts run the unit tests with all supported PHP versions.

Tests

The library registers the test runner as composer script.

composer test

All units tests can also be run in the development containers specified in the docker directory.

About

PHP port of Ecoji with 100% test coverage.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors