{"id":21467419,"url":"https://github.com/elusivecodes/fyreconsole","last_synced_at":"2025-07-15T05:31:31.186Z","repository":{"id":57677007,"uuid":"489330622","full_name":"elusivecodes/FyreConsole","owner":"elusivecodes","description":"FyreConsole is a free, open-source CLI library for PHP.","archived":false,"fork":false,"pushed_at":"2024-10-30T14:08:09.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T14:49:46.366Z","etag":null,"topics":["cli","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/elusivecodes.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-06T11:36:28.000Z","updated_at":"2024-10-30T14:07:42.000Z","dependencies_parsed_at":"2023-11-28T14:52:56.168Z","dependency_job_id":null,"html_url":"https://github.com/elusivecodes/FyreConsole","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"262277c6b8486b488c6deeb16fa0bd8fd867a621"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreConsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreConsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreConsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreConsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreConsole/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017498,"owners_count":17560522,"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":["cli","console","php"],"created_at":"2024-11-23T08:17:56.917Z","updated_at":"2025-07-15T05:31:31.153Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreConsole\r\n\r\n**FyreConsole** is a free, open-source CLI library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Static Methods](#static-methods)\r\n- [Colors](#colors)\r\n- [Styles](#styles)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/console\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Console\\Console;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$input` is the input stream, and will default to `STDIN` (or `null` for non-CLI usage).\r\n- `$output` is the output stream, and will default to `STDOUT` (or \"*php://output*\" for non-CLI usage).\r\n- `$error` is the error stream, and will default to `STDERR` (or \"*php://output*\" for non-CLI usage).\r\n\r\n```php\r\n$io = new Console($input, $output, $error);\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**Choice**\r\n\r\nPrompt to make a choice out of available options.\r\n\r\n- `$text` is a string representing the prompt text.\r\n- `$options` is an array containing the options.\r\n- `$default` is a string representing the default option, and will default to *null*.\r\n\r\n```php\r\n$choice = $io-\u003echoice($text, $options, $default);\r\n```\r\n\r\n**Comment**\r\n\r\nOutput comment text.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to *null*.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to `Console::DIM`.\r\n\r\n```php\r\n$io-\u003ecomment($text);\r\n```\r\n\r\n**Confirm**\r\n\r\nPrompt to confirm with y/n options.\r\n\r\n- `$text` is a string representing the prompt text.\r\n- `$default` is a boolean representing the default option, and will default to *true*.\r\n\r\n```php\r\n$confirm = $io-\u003econfirm($text, $default);\r\n```\r\n\r\n**Error**\r\n\r\nOutput text to *STDERR*.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to `Console::RED`.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$io-\u003eerror($text, $options);\r\n```\r\n\r\n**Info**\r\n\r\nOutput info text.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to `Console::BLUE`.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$io-\u003einfo($text, $options);\r\n```\r\n\r\n**Input**\r\n\r\nRead a line of input.\r\n\r\n```php\r\n$input = $io-\u003einput();\r\n```\r\n\r\n**Progress**\r\n\r\nOutput a progress indicator.\r\n\r\n- `$step` is a number representing the current step, and will default to *null*.\r\n- `$totalSteps` is a number representing the total steps, and will default to *10*.\r\n\r\n```php\r\n$io-\u003eprogress($step, $totalSteps);\r\n```\r\n\r\nSequential calls to this method will update the progress indicator. If the `$step` is set to *null* the indicator will be cleared.\r\n\r\n**Prompt**\r\n\r\nPrompt the user for input.\r\n\r\n- `$text` is a string representing the prompt text.\r\n\r\n```php\r\n$prompt = $io-\u003eprompt($text);\r\n```\r\n\r\n**Success**\r\n\r\nOutput success text.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to `Console::GREEN`.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$io-\u003esuccess($text, $options);\r\n```\r\n\r\n**Table**\r\n\r\nOutput a table.\r\n\r\n- `$data` is an array containing the table rows.\r\n- `$header` is an array containing the table header columns, and will default to *[]*.\r\n\r\n```php\r\n$io-\u003etable($data, $header);\r\n```\r\n\r\n**Warning**\r\n\r\nOutput warning text.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to `Console::YELLOW`.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$io-\u003ewarning($text, $options);\r\n```\r\n\r\n**Write**\r\n\r\nOutput text to *STDOUT*.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to `Console::YELLOW`.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$io-\u003ewrite($text, $options);\r\n```\r\n\r\n\r\n## Static Methods\r\n\r\n**Get Height**\r\n\r\nGet the terminal height (in characters).\r\n\r\n```php\r\n$height = Console::getHeight();\r\n```\r\n\r\n**Get Width**\r\n\r\nGet the terminal width (in characters).\r\n\r\n```php\r\n$width = Console::getWidth();\r\n```\r\n\r\n**Style**\r\n\r\nStyle text for terminal output.\r\n\r\n- `$text` is a string representing the text.\r\n- `$options` is an array containing the color options.\r\n    - `color` is a number representing the text [color](#colors), and will default to *null*.\r\n    - `bg` is a number representing the background [color](#colors), and will default to *null*.\r\n    - `style` is a number indicating the text [style](#styles), and will default to *null*.\r\n\r\n```php\r\n$style = Console::style($text, $options);\r\n```\r\n\r\n**Wrap**\r\n\r\nWrap text for terminal output.\r\n\r\n- `$text` is a string representing the text.\r\n- `$maxWidth` is a number representing the maximum character width of a line, and will default to the terminal width.\r\n\r\n```php\r\n$wrap = Console::wrap($text, $maxWidth);\r\n```\r\n\r\n\r\n## Colors\r\n\r\n```php\r\nConsole::BLACK; // 30\r\nConsole::RED; // 31\r\nConsole::GREEN; // 32\r\nConsole::YELLOW; // 33\r\nConsole::BLUE; // 34\r\nConsole::PURPLE; // 35\r\nConsole::CYAN; // 36\r\nConsole::WHITE; // 37\r\nConsole::GRAY; // 47\r\nConsole::DARKGRAY; // 100\r\n```\r\n\r\n\r\n## Styles\r\n\r\n```php\r\nConsole::BOLD; // 1\r\nConsole::DIM; // 2\r\nConsole::ITALIC; // 3\r\nConsole::UNDERLINE; // 4\r\nConsole::FLASH; // 5\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyreconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreconsole/lists"}