Wallogit.com
2017 © Pedro Peláez
Abstraction for creating a grid of content in a terminal window, (*1)
Ever wanted to create say, a game of chess in PHP in the terminal, but couldn't be bothered to make a grid? No? I thought not., (*2)
If you did decide you wanted to do such a thing, this project might be helpful to you. It uses all the assorted box character unicode stuff to generate a half reasonable grid., (*3)
// Usage is something like this $gridRenderer = \Dolondro\TheGrid\GridRenderer::create(); $gridRenderer->render([[ "Cell1" ]]);
There's a half baked example which gives you a decent idea of how to use it in examples/test.php and if you need guidance and here's a copied comment that explains what the format of a cell should look like:, (*4)
// Create expects a multi-dimensional array. Each "cell" in the array should either be: // 1. null (will result in nothing being rendered) // 2. a value (like the number 5 or what have you) // 3. an array like so: [$value, $colour]. Colour should be in ansi style format (like "\033[31m"). // a comprehensive list of them can be accessed directly from Color::COLOR_BLAH
Good luck have have fun!, (*5)