{"id":22085969,"url":"https://github.com/zmotrin/php-wcli","last_synced_at":"2025-07-24T17:31:41.701Z","repository":{"id":140730637,"uuid":"36479701","full_name":"ZmotriN/php-wcli","owner":"ZmotriN","description":"Windows CLI native support for PHP","archived":false,"fork":false,"pushed_at":"2024-05-11T19:14:49.000Z","size":285,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-04T22:11:56.551Z","etag":null,"topics":["cli","php","php-extension","php8","wcli","windows"],"latest_commit_sha":null,"homepage":"","language":"C","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/ZmotriN.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2015-05-29T03:06:20.000Z","updated_at":"2025-01-26T17:05:29.000Z","dependencies_parsed_at":"2024-05-02T01:34:18.347Z","dependency_job_id":"3973592f-8a2f-490a-9506-8dade713cc42","html_url":"https://github.com/ZmotriN/php-wcli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ZmotriN/php-wcli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-wcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-wcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-wcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-wcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZmotriN","download_url":"https://codeload.github.com/ZmotriN/php-wcli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-wcli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266878572,"owners_count":23999619,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","php","php-extension","php8","wcli","windows"],"created_at":"2024-12-01T01:17:24.650Z","updated_at":"2025-07-24T17:31:41.407Z","avatar_url":"https://github.com/ZmotriN.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-wcli\nPHP Extension for Windows CLI native support.\n\n![image](https://github.com/ZmotriN/php-wcli/assets/8278142/e91d98b8-fb5a-4db4-b570-e2660ba83f00)\n\n\n## Constants\n\n### Color Codes\nColor constants can be use in combination with the Bright flag.\\\nEx: wcli_echo(\"Hello World!\", Black, Red|Bright);\n```php\nconst Red    = 4;  // Red color\nconst Green  = 2;  // Green color\nconst Blue   = 1;  // Blue color\nconst Yellow = 14; // Yellow color\nconst Purple = 5;  // Purple color\nconst Aqua   = 3;  // Aqua color\nconst White  = 7;  // White color\nconst Black  = 0;  // Black color\nconst Grey   = 8;  // Grey color\nconst Bright = 8;  // Bright Flag\n```\n### Virtual Key Codes\nAll the VK_* constants defined here:\nhttps://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes \\\nAdditionally we defines keys from 0x30 to 0x5A.\n```php\nconst VK_0 = 0x30; // 0 key\nconst VK_1 = 0x31; // 1 key\nconst VK_2 = 0x32; // 2 key\nconst VK_3 = 0x33; // 3 key\nconst VK_4 = 0x34; // 4 key\nconst VK_5 = 0x35; // 5 key\nconst VK_6 = 0x36; // 6 key\nconst VK_7 = 0x37; // 7 key\nconst VK_8 = 0x38; // 8 key\nconst VK_9 = 0x39; // 9 key\nconst VK_A = 0x41; // A key\nconst VK_B = 0x42; // B key\nconst VK_C = 0x43; // C key\nconst VK_D = 0x44; // D key\nconst VK_E = 0x45; // E key\nconst VK_F = 0x46; // F key\nconst VK_G = 0x47; // G key\nconst VK_H = 0x48; // H key\nconst VK_I = 0x49; // I key\nconst VK_J = 0x4A; // J key\nconst VK_K = 0x4B; // K key\nconst VK_L = 0x4C; // L key\nconst VK_M = 0x4D; // M key\nconst VK_N = 0x4E; // N key\nconst VK_O = 0x4F; // O key\nconst VK_P = 0x50; // P key\nconst VK_Q = 0x51; // Q key\nconst VK_R = 0x52; // R key\nconst VK_S = 0x53; // S key\nconst VK_T = 0x54; // T key\nconst VK_U = 0x55; // U key\nconst VK_V = 0x56; // V key\nconst VK_W = 0x57; // W key\nconst VK_X = 0x58; // X key\nconst VK_Y = 0x59; // Y key\nconst VK_Z = 0x5A; // Z key\n```\n\n\n## Handle functions\n\n### wcli_get_output_handle\n```php\n/**\n * Get the console output handle.\n *\n * @return int|bool Output handle\n */\nfunction wcli_get_output_handle(): int|bool {}\n\n```\n\n### wcli_get_input_handle\n```php\n/**\n * Get the console input handle.\n *\n * @return int|bool Input handle\n */\nfunction wcli_get_input_handle(): int|bool {}\n\n```\n\n### wcli_get_window_handle\n```php\n/**\n * Get the console window handle.\n *\n * @return int|bool Window handle\n */\nfunction wcli_get_window_handle(): int|bool {}\n\n```\n\n\n## Console functions\n\n### wcli_get_console_title\n```php\n/**\n * Return the console title.\n *\n * @return string|bool The console title, otherwise false.\n */\nfunction wcli_get_console_title(): string|bool {}\n\n```\n\n### wcli_set_console_title\n```php\n/**\n * Set the console title.\n *\n * @param string $title The console title\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_console_title(string $title): bool {}\n\n```\n\n### wcli_get_console_size\n```php\n/**\n * Retrieve the size and the scrolling in characters of the console.\n * Return an array [w, h, x, y]\n *\n * @return array|bool Return the console size or FALSE.\n */\nfunction wcli_get_console_size(): array|bool {}\n```\n\n### wcli_set_console_size\n```php\n/**\n * Set the console size in characters.\n * Set the $force parameter to true to force the buffer at the same size.\n *\n * @param int $w Width of the console in characters\n * @param int $h Height of the console in characters\n * @param bool $force Default false.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_console_size(int $w, int $h, bool $force = false): bool {}\n```\n\n### wcli_get_buffer_size\n```php\n/**\n * Retrieve console buffer size in characters.\n * Return an array [w, h]\n *\n * @return array|bool Return the buffer size or FALSE.\n */\nfunction wcli_get_buffer_size(): array|bool {}\n```\n\n### wcli_set_buffer_size\n```php\n/**\n * Set the console buffer size in characters.\n * The buffer size need to be bigger than the console size.\n * Otherwise, set the console size before the buffer size.\n *\n * @param int $w Width of the buffer in characters\n * @param int $h Height of the buffer in characters\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_buffer_size(int $w, int $h): bool {}\n```\n\n### wcli_get_code_page\n```php\n/**\n * Retrieves the input code page used by the console.\n * See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers\n *\n * @return int Code Page ID\n */\nfunction wcli_get_code_page(): int {}\n```\n\n### wcli_set_code_page\n```php\n/**\n * Set the input code page used by the console.\n * See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers\n *\n * @param int $cpID Code Page ID\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_code_page(int $cpID): bool {}\n```\n\n### wcli_get_font_size\n```php\n/**\n * Retrieve console font size in pixels.\n * Return an array [width, height]\n *\n * @return array|bool The font size, otherwise false.\n */\nfunction wcli_get_font_size(): array|bool {}\n```\n\n\n## Color functions\n\n### wcli_get_foreground_color\n```php\n/**\n * Get the foreground color.\n *\n * @return int Color Constant\n */\nfunction wcli_get_foreground_color(): int {}\n```\n\n### wcli_set_foreground_color\n```php\n/**\n * Set the foreground color.\n *\n * @param int $color Color Constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_foreground_color(int $color): bool {}\n```\n\n### wcli_get_background_color\n```php\n/**\n * Get the background color.\n *\n * @return int Color Constant\n */\nfunction wcli_get_background_color(): int {}\n```\n\n### wcli_set_background_color\n```php\n/**\n * Set the background color.\n *\n * @param int $color Color constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_background_color(int $color): bool {}\n```\n\n### wcli_get_colors\n```php\n/**\n * Retrieve console foreground and background colors.\n * Return an array [foreColor, backColor]\n *\n * @return array|bool The array of colors or False\n */\nfunction wcli_get_colors(): array|bool {}\n```\n\n### wcli_set_colors\n```php\n/**\n * Set the foreground and background color at once.\n *\n * @param int $fore Foreground color constant\n * @param int $back Background color constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_colors(int $fore, int $back): bool {}\n```\n\n### wcli_inverse_colors\n```php\n/**\n * Swap foreground and background colors.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_inverse_colors(): bool {}\n```\n\n### wcli_reset_colors\n```php\n/**\n * Reset console colors to default.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_reset_colors(): bool {}\n```\n\n\n## Cursor functions\n\n### wcli_hide_cursor\n```php\n/**\n * Hide console cursor.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_hide_cursor(): bool {}\n```\n\n### wcli_show_cursor\n```php\n/**\n * Show console cursor.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_show_cursor(): bool {}\n```\n\n### wcli_get_cursor_visibility\n```php\n/**\n * Retrieve cursor visibility.\n *\n * @return bool True if visible, else false.\n */\nfunction wcli_get_cursor_visibility(): bool {}\n```\n\n### wcli_set_cursor_visibility\n```php\n/**\n * Set cursor visibility.\n *\n * @param bool $visible True to show, false to hide.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_cursor_visibility(bool $visible): bool {}\n```\n\n### wcli_get_cursor_size\n```php\n/**\n * Retrieve cursor size.\n * The size value is between 0 and 100.\n *\n * @return int|bool The cursor size if success, else false.\n */\nfunction wcli_get_cursor_size(): int|bool {}\n```\n\n### wcli_set_cursor_size\n```php\n/**\n * Set cursor size.\n *\n * @param int $size Cursor size between 0 and 100.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_cursor_size(int $size): bool {}\n```\n\n### wcli_get_cursor_position\n```php\n/**\n * Retrieve cursor position.\n * Return an array [x, y]\n *\n * @return array|bool The cursor position or false.\n */\nfunction wcli_get_cursor_position(): array|bool {}\n```\n\n### wcli_set_cursor_position\n```php\n/**\n * Set cursor position.\n *\n * @param int $x X position in characters\n * @param int $y Y position in characters\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_cursor_position(int $x, int $y): bool {}\n```\n\n### wcli_move_cursor\n```php\n/**\n * Move cursor position relatively to the current cursor position.\n *\n * @param int $x X move in characters\n * @param int $y Y move in characters\n *\n * @return bool True if success, else false.\n */\nfunction wcli_move_cursor(int $x, int $y): bool {}\n```\n\n\n## Output functions\n\n### wcli_echo\n```php\n/**\n * Echo string with colors. Foreground and background colors are optionals.\n *\n * @param string $str String to be echo.\n * @param int $fore Foreground color constant\n * @param int $back Background color constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_echo(string $str, int $fore = null, int $back = null): bool {}\n```\n\n### wcli_print\n```php\n/**\n * Print string with colors at the x-y position without changing cursor position.\n *\n * @param string $str String to be print\n * @param int $x X position in characters\n * @param int $y Y position in characters\n * @param int $fore Foreground color constant\n * @param int $back Background color constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_print(string $str, int $x = null, int $y = null, int $fore = null, int $back = null): bool {}\n```\n\n### wcli_fill\n```php\n/**\n * Method fill rect with character and colors.\n *\n * @param int $c Character to fill\n * @param int $x X position of the rect\n * @param int $y Y position of the rect\n * @param int $w Width of the rect\n * @param int $h Height of the rect\n * @param int $fore Foreground color constant\n * @param int $back Background color constant\n *\n * @return bool True if success, else false.\n */\nfunction wcli_fill(int $c, int $x, int $y, int $w, int $h, int $fore = null, int $back = null): bool {}\n```\n\n### wcli_clear\n```php\n/**\n * Clear the console.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_clear(): bool {}\n```\n\n\n## Input functions\n\n### wcli_get_key\n```php\n/**\n * Pause process and wait for a keyboard input.\n *\n * @return int|bool The input character otherwise false.\n */\nfunction wcli_get_key(): int|bool {}\n```\n\n### wcli_get_key_async\n```php\n/**\n * Get an async keyboard input.\n *\n * @return int|bool The input character otherwise false.\n */\nfunction wcli_get_key_async(): int|bool {}\n```\n\n### wcli_flush_input_buffer\n```php\n/**\n * Flush console input buffer.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_flush_input_buffer(): bool {}\n```\n\n## Window functions\n\n### wcli_is_on_top\n```php\n/**\n * Verify if console window is on top.\n *\n * @return bool True if window is on top, otherwise false.\n */\nfunction wcli_is_on_top(): bool {}\n```\n\n### wcli_is_visible\n```php\n/**\n * Verify if console window is visible.\n *\n * @return bool True if window is visible, otherwise false.\n */\nfunction wcli_is_visible(): bool {}\n```\n\n### wcli_get_window_area\n```php\n/**\n * Retrieve console window area.\n * Return an array [x, y, width, height]\n *\n * @return array|bool The console window area array, otherwise false.\n */\nfunction wcli_get_window_area(): array|bool {}\n```\n\n\n### wcli_get_client_area\n```php\n/**\n * Retrieve console window inner area.\n * Return an array [x, y, width, height]\n *\n * @return array|bool The console window inner area array, otherwise false.\n */\nfunction wcli_get_client_area(): array|bool {}\n```\n\n### wcli_minimize\n```php\n/**\n * Minimize console window.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_minimize(): bool {}\n```\n\n### wcli_maximize\n```php\n/**\n * Maximize console window.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_maximize(): bool {}\n```\n\n### wcli_restore\n```php\n/**\n * Restore console window.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_restore(): bool {}\n```\n\n### wcli_activate\n```php\n/**\n * Force console window to activate.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_activate(): bool {}\n```\n\n### wcli_flash\n```php\n/**\n * Flash console window.\n *\n * @param bool $invert If TRUE, the window is flashed from one state to the other.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_flash(bool $invert = false): bool {}\n```\n\n### wcli_bring_to_front\n```php\n/**\n * Bring console window to front.\n *\n * @return bool True if success, else false.\n */\nfunction wcli_bring_to_front(): bool {}\n```\n\n### wcli_set_position\n```php\n/**\n * Set console window position.\n *\n * @param int $x X position in pixels\n * @param int $y Y position in pixels\n *\n * @return bool True if success, else false.\n */\nfunction wcli_set_position(int $x, int $y): bool {}\n```\n\n\n## Misc functions\n\n### wcli_get_module_path\n```php\n/**\n * Return module/executable full path.\n * Usefull for SAPI.\n *\n * @return string Module full path\n */\nfunction wcli_get_module_path(): string {}\n```\n\n### wcli_get_parent_pid\n```php\n/**\n * Get parent process ID.\n *\n * @return int|bool Parent process ID, otherwise false.\n */\nfunction wcli_get_parent_pid(): int|bool {}\n```\n\n### wcli_is_cmd_call\n```php\n/**\n * Know if the process was lunch by a terminal.\n *\n * @return bool True if yes, otherwise false.\n */\nfunction wcli_is_cmd_call(): bool {}\n```\n\n### wcli_where\n```php\n/**\n * Search filename in environment path.\n *\n * @param string $filename Filename to search for.\n *\n * @return string|bool The full path of the file, otherwise false.\n */\nfunction wcli_where(string $filename): string|bool {}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmotrin%2Fphp-wcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmotrin%2Fphp-wcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmotrin%2Fphp-wcli/lists"}