• Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terminal drawing with braille

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.