Home

Awesome

php-drawille

Terminal drawing with braille.

Octocat example

Requirements

php-drawille requires PHP 5.4.0 or later.

Installation

The recommended way to install php-drawille is through composer. Just create a composer.json file and run the php composer.phar install command to install it:

{
    "require": {
        "whatthejeff/drawille": "~1.0"
    }
}

Usage

use Drawille\Canvas;

$canvas = new Canvas();

for($x = 0; $x <= 1800; $x += 10) {
    $canvas->set($x / 10, 10 + sin($x * M_PI / 180) * 10);
}

echo $canvas->frame(), "\n";

Usage example

use Drawille\Turtle;

$turtle = new Turtle();

for($x = 0; $x < 36; $x++) {
    $turtle->right(10);

    for($y = 0; $y < 36; $y++) {
        $turtle->right(10);
        $turtle->forward(8);
    }
}

echo $turtle->frame(), "\n";

Turtle example

Examples

To use the scripts in the examples directory, you need to install the dependencies with composer.

$ cd examples
$ php composer.phar install
$ ./img2term.php --fab --threshold 600 ~/Pictures/sb.png

img2term example

Tests

Build Status

To run the test suite, you need composer.

$ php composer.phar install
$ vendor/bin/phpunit

Acknowledgements

php-drawille is a port of drawille.

License

php-drawille is licensed under the MIT license.