{"id":36970835,"url":"https://github.com/xp-forge/terminal","last_synced_at":"2026-01-13T21:50:44.920Z","repository":{"id":57084823,"uuid":"61477204","full_name":"xp-forge/terminal","owner":"xp-forge","description":"Terminal control","archived":true,"fork":false,"pushed_at":"2020-10-04T14:11:26.000Z","size":53,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-20T16:52:48.560Z","etag":null,"topics":["colors","terminal","xp-framework"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xp-forge.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-19T11:35:02.000Z","updated_at":"2023-01-28T05:46:58.000Z","dependencies_parsed_at":"2022-08-24T22:50:52.817Z","dependency_job_id":null,"html_url":"https://github.com/xp-forge/terminal","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/xp-forge/terminal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fterminal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fterminal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fterminal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fterminal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xp-forge","download_url":"https://codeload.github.com/xp-forge/terminal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fterminal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["colors","terminal","xp-framework"],"created_at":"2026-01-13T21:50:44.394Z","updated_at":"2026-01-13T21:50:44.913Z","avatar_url":"https://github.com/xp-forge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Terminal\n========\n\n[![Build Status on TravisCI](https://secure.travis-ci.org/xp-forge/terminal.png)](https://travis-ci.org/xp-forge/terminal)\n[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)\n[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)\n[![Supports PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.png)](http://php.net/)\n[![Latest Stable Version](https://poser.pugx.org/xp-forge/terminal/version.png)](https://packagist.org/packages/xp-forge/terminal)\n\nThe terminal library adds support for color to the `util.cmd.Console` class.\n\n![Screenshot](https://raw.githubusercontent.com/xp-forge/terminal/master/terminal-styles.png)\n\nStyles\n------\nThere are five predefined styles:\n\n```php\nuse util\\cmd\\Console;\n\nConsole::writeLine('This is \u003cprimary\u003eprimary\u003c/\u003e!');\nConsole::writeLine('This is \u003csuccess\u003esuccess\u003c/\u003e!');\nConsole::writeLine('This is \u003cinfo\u003einfo\u003c/\u003e!');\nConsole::writeLine('This is \u003cwarning\u003ewarning\u003c/\u003e!');\nConsole::writeLine('This is \u003cdanger\u003edanger\u003c/\u003e!');\n```\n\nColors\n------\nFor direct color control, the colors can be chosen directly by supplying their names. Foreground and background colors are separated by the `@` sign:\n\n```php\nuse util\\cmd\\Console;\n\nConsole::writeLine('\u003cred\u003eAn error occured\u003c/\u003e');\nConsole::writeLine('\u003cwhite@green\u003eOK: 100 Tests succeeded\u003c/\u003e');\n```\n\nThe colors' names are black, dark-red, dark-green, dark-yellow, dark-blue, dark-magenta, dark-cyan, gray, dark-gray, red, green, yellow, blue, magenta, cyan and white.\n\nAttributes\n----------\nThere are three more attributes. Not all terminals support these, though!\n\n```php\nuse util\\cmd\\Console;\n\nConsole::writeLine('\u003cunderline\u003ehttp://localhost\u003c/\u003e');\nConsole::writeLine('\u003cbold\u003eWatch out!\u003c/\u003e');\nConsole::writeLine('\u003citalic\u003e- The XP Framework group\u003c/\u003e');\n\n// Can be combined, too\nConsole::writeLine('\u003cdark-blue,underline\u003ehttp://localhost\u003c/\u003e');\n```\n\nPositioning\n-----------\nThe `util.cmd.term.Terminal` class allows clearing the screen, positioning the cursor and writing text there.\n\n![Screenshot](https://raw.githubusercontent.com/xp-forge/terminal/master/terminal-clock.png)\n\n```php\nuse util\\cmd\\term\\Terminal;\n\n$message= 'Hello from the middle of the screen';\n\n// Center text in third line\n$dim= Terminal::size();\n$x= ($dim[0] - strlen($message)) / 2;\n$y= 3;\n\nTerminal::clear();\nTerminal::write($x, $y, $message);\n```\n\nFor the more advanced example seen above in the screenshot, have a look at [this code](https://gist.github.com/thekid/d1a38a0743733d2270968d7eac8f43c9).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fterminal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxp-forge%2Fterminal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fterminal/lists"}