{"id":15674520,"url":"https://github.com/matks/vivian","last_synced_at":"2025-05-06T23:18:33.293Z","repository":{"id":21774165,"uuid":"25096459","full_name":"matks/Vivian","owner":"matks","description":"Pretty console output in PHP","archived":false,"fork":false,"pushed_at":"2017-06-20T12:13:57.000Z","size":69,"stargazers_count":14,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T23:18:27.987Z","etag":null,"topics":["console","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-11T21:44:42.000Z","updated_at":"2024-07-03T09:06:46.000Z","dependencies_parsed_at":"2022-08-19T16:50:46.423Z","dependency_job_id":null,"html_url":"https://github.com/matks/Vivian","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matks%2FVivian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matks%2FVivian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matks%2FVivian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matks%2FVivian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matks","download_url":"https://codeload.github.com/matks/Vivian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782846,"owners_count":21803411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","php"],"created_at":"2024-10-03T15:46:08.876Z","updated_at":"2025-05-06T23:18:33.264Z","avatar_url":"https://github.com/matks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Vivian\n======\n\n[![Latest Stable Version](https://poser.pugx.org/matks/vivian/v/stable.svg)](https://packagist.org/packages/matks/vivian)\n[![Build Status](https://travis-ci.org/matks/Vivian.png)](https://travis-ci.org/matks/Vivian)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/matks/Vivian/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/matks/Vivian/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/matks/Vivian/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/matks/Vivian/?branch=master)\n[![Latest Unstable Version](https://poser.pugx.org/matks/vivian/v/unstable.svg)](https://packagist.org/packages/matks/vivian)\n[![License](https://poser.pugx.org/matks/vivian/license.svg)](https://packagist.org/packages/matks/vivian)\n\nTools to provide a pretty console output in ANSI/VT100 terminals\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/3830050/5061655/3202b658-6da0-11e4-8211-dce2fef12fc6.png\" width=\"400px\"/\u003e\n\n## Installation\n\nInstall the dependencies with composer\n```bash\ncomposer install\n```\n\n## Tests\n\nInstall the dev dependencies with composer\n```bash\ncomposer install --dev\n```\n\nRun the unit tests suite with atoum binary.\n```bash\nvendor/bin/atoum -bf vendor/autoload.php -d tests/Units/\n```\n\n## Usage\n\n### Tool\n\nFor simple styles, the class Matks\\Vivian\\Tools provide a useful call interface, for example:\n```php\nuse Matks\\Vivian\\Tools as Output;\n\necho Output::bold('... done.') . PHP_EOL;\n\nif ($success) {\n\techo Output::green('Success');\n\techo PHP_EOL;\n} else {\n\techo Output::red('Failure !');\n\techo PHP_EOL;\n\techo Output::s_list1($errors);\n}\n```\n\nSee the examples in tests/Console:\n```bash\nphp tests/Console/test-color\nphp tests/Console/test-background-color\nphp tests/Console/test-style\nphp tests/Console/test-border\nphp tests/Console/test-mixed\nphp tests/Console/test-structure\nphp tests/Console/test-figlet\n```\nor\n```bash\nbash tests/Console/test-all.sh\n```\n\n### Elements\n\nFor advanced displays, build the Elements you need:\n\n#### Text Element\n\n```php\nuse Matks\\Vivian\\Color;\nuse Matks\\Vivian\\Style;\nuse Matks\\Vivian\\Output;\n\n$textElement = new Output\\TextElement('Hello world !');\n\n$boldStyle             = new Style\\Style(Style\\StyleManager::BASH_BOLD);\n$greenColor            = new Color\\TextColor(Color\\TextColorManager::BASH_FOREGROUND_GREEN);\n$cyanBackgroundColor   = new Color\\BackgroundColor(Color\\BackgroundColorManager::BASH_BACKGROUND_CYAN);\n\n$textElement-\u003esetTextColor($greenColor)\n            -\u003esetBackgroundColor($cyanBackgroundColor)\n            -\u003eaddStyle($boldStyle)\n;\n\necho $textElement-\u003erender();\n```\n\n#### Bordered Element\n\n```php\nuse Matks\\Vivian\\Border;\nuse Matks\\Vivian\\Color;\nuse Matks\\Vivian\\Output;\n\n$yellowColor = new Color\\TextColor(Color\\TextColorManager::BASH_FOREGROUND_YELLOW);\n$border      = new Border\\Border(Border\\Border::TYPE_FRAME);\n\n$borderedElement = new Output\\BorderedElement('Hello world !', $border);\n$borderedElement-\u003esetTextColor($yellowColor);\n\necho $borderedElement-\u003erender();\n```\n\n#### Structured Elements\n\n```php\nuse Matks\\Vivian\\Color;\nuse Matks\\Vivian\\Output;\nuse Matks\\Vivian\\Style;\nuse Matks\\Vivian\\Structure;\n\n$greenColor     = new Color\\TextColor(Color\\TextColorManager::BASH_FOREGROUND_GREEN);\n$redColor       = new Color\\TextColor(Color\\TextColorManager::BASH_FOREGROUND_RED);\n$blinkingStyle  = new Style\\Style(Style\\StyleManager::BASH_BLINK);\n\n$textElement1 = new Output\\TextElement('Hello');\n$textElement2 = new Output\\TextElement('world');\n$textElement3 = new Output\\TextElement('!');\n$textElement1-\u003esetTextColor($greenColor);\n$textElement2-\u003esetTextColor($redColor);\n$textElement3-\u003eaddStyle($blinkingStyle);\n\n$elements = array(\n    $textElement1,\n    $textElement2,\n    $textElement3\n);\n\n$structure  = new Structure\\Structure(Structure\\Structure::TYPE_LIST, '#', '  ');\n$structuredElements = new Output\\StructuredElements($elements, $structure);\necho $structuredElements-\u003erender();\n```\n\n## More about ANSI/VT100 terminal control\n\nhttp://www.termsys.demon.co.uk/vtansi.htm\n\n## License\n\nVivian is licensed under the MIT License - see the LICENSE file for details\n\n## More advanced features\n\nI found a far more efficient library doing the same purpose: [CLImate](https://github.com/thephpleague/climate). I recommend it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatks%2Fvivian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatks%2Fvivian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatks%2Fvivian/lists"}