console

symfonyMIT活跃维护

Symfony 的 PHP 命令行组件,帮你快速搭建带参数解析、输入输出格式化和可测试性的终端命令,不用自己处理底层细节。

Eases the creation of beautiful and testable command line interfaces

v8.2.0-BETA1发布于 2026-11-04 12:40 UTC9,812star263fork同步于 2026-11-10 11:30 UTC

怎么上手

由 README 提炼,执行前请确认
composer require symfony/console
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

Symfony 的 Console 组件,帮你快速构建美观且可测试的命令行界面

Symfony 的 PHP 命令行组件,帮你快速搭建带参数解析、输入输出格式化和可测试性的终端命令,不用自己处理底层细节。

核心能力

  • 提供构建命令行界面的基础组件
  • 强调命令行界面的可测试性
  • 随组件附带 hiddeninput.exe 二进制用于隐藏输入

容易踩的坑

README 未给出使用示例,需查阅官方文档;组件内含第三方二进制 Resources/bin/hiddeninput.exe,注意其来源与许可证

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v8.2.0-BETA1
  1. v8.2.0-BETA1最新正式版2026-11-04 · 2026-11-04 12:40 UTC

    Changelog (https://github.com/symfony/console/compare/v8.1.11...v8.2.0-BETA1)

    • minor #67499 Warn about deprecated options passed by their negation or any of their shortcuts (@jack-worman)
    • minor #67319 Adapt Composer hints when using Symfony CLI (@nicolas-grekas)
    • minor #67316 Add command.invocation and migrate command examples (@nicolas-grekas)
    • minor #67328 Avoid temporary arrays when checking autocompletion keys (@andreybolonin)
    • feature #67258 Add suggestPaths() and suggestDirectories() to let the shell complete paths (@nicolas-grekas)
    • minor #67244 Improve the descriptions of the types and attributes registered for autoconfiguration (@nicolas-grekas)
    • minor #66985 Add an ASCII fast path to Helper::length() and Helper::substr() (@javiereguiluz)
    • minor #66976 Build the escape sequences of a color only once (@javiereguiluz)
    • minor #66968 Skip the stty probe when STDIN is not a terminal (@javiereguiluz)
    • minor #66961 Speed up writing to a section in several steps (@javiereguiluz)
    • feature #66950 Exit with 128 + the signal number when a signal stops the application (@lyrixx)
    • minor #66865 Add ttl param to LockableTrait::lock() (@HypeMC)
    • feature #66770 List the accepted values of enum arguments and options in the help (@nicolas-grekas)
    • minor #66775 Wrap exception messages on word boundaries (@nicolas-grekas)
    • feature #66622 Support lists of backed enums in # and # (@KalimeroMK)
    • feature #66020 Autowire the lock factory named "console" in LockableTrait (@nicolas-grekas)
    • feature #65853 Register class-level # groups and let the attribute list options (@nicolas-grekas)
    • feature #65825 Add docker-style sub-commands, resolved as command trees from registered names (@nicolas-grekas)
    • minor #65803 Declare docblock types for parameters of addArgument() and addOption() (@rgeraads)
    • feature #65616 Allow dropping multiple files (@chalasr)
    • feature #65368 Support union and intersection types as controller and command arguments (@HypeMC)
    • bug #65359 Fix "regular expression is too large" when wrapping on wide terminals (@HypeMC)
    • feature #63784 Auto-wrap TextDescriptor output based on terminal width (@Bellangelo)
    • feature #65304 Revert "Add a listedAt option to list a command only from a given verbosity" (@MatTheCat)
    • feature #64117 Add a gitlab output format to the lint:yaml command (@revoltek-daniel)
    • feature #61677 Allow callables for the description and help of #, # and # (@MacDada)
    • feature #64723 Add a listedAt option to list a command only from a given verbosity (@jprivet-dev)
    • feature #54439 Add hidden and deprecated option modes (@flkasper)
    • feature #64709 Improve FileInputHelper paste detection read performance (@jorgsowa)
  2. v8.1.112026-11-04 · 2026-11-04 11:32 UTC
    查看更新说明

    Changelog (https://github.com/symfony/console/compare/v8.1.10...v8.1.11)

    • bug #67832 Fix ProgressBar::iterate() keeping the max of a previous iterable for a non-countable one (@nicolas-grekas)
    • bug #67831 Fix ProgressBar's percent after finish() on undecorated output without a max (@nicolas-grekas)
    • bug #67830 Fix ProgressBar::finish() with a lowered max and restarting a finished bar without a max (@jack-worman)
    • bug #67823 Fix ProgressBar frames on undecorated output when resuming, restarting or finishing (@jack-worman)
    • bug #67811 Fix ProgressBar::setMaxSteps() not updating the percentage (@nicolas-grekas)
    • bug #67805 Fix ProgressBar::start() computing the percentage against the previous max (@jack-worman)
    • bug #67770 Fix outline block lines ending with a backslash (@nicolas-grekas)
    • bug #67769 Fix text ending with a backslash escaping the closing tag that follows it (@nicolas-grekas)
    • bug #67762 Keep an escaped tag delimiter with its backslash when wrapping text (@initd-it)
    • bug #67677 Register service argument locators under the resolved names of commands (@kbond)
    • bug #67634 Fix setRow(), setColumnMaxWidth() and consecutive rowspans in Table (@nicolas-grekas)
    • bug #67633 Fix Table cells that span rows when they follow a cell that spans columns (@ybai08)

    [SECURITY] Security release

  3. v7.4.232026-11-04 · 2026-11-04 11:28 UTC
    查看更新说明

    Changelog (https://github.com/symfony/console/compare/v7.4.22...v7.4.23)

    • bug #67832 Fix ProgressBar::iterate() keeping the max of a previous iterable for a non-countable one (@nicolas-grekas)
    • bug #67831 Fix ProgressBar's percent after finish() on undecorated output without a max (@nicolas-grekas)
    • bug #67830 Fix ProgressBar::finish() with a lowered max and restarting a finished bar without a max (@jack-worman)
    • bug #67823 Fix ProgressBar frames on undecorated output when resuming, restarting or finishing (@jack-worman)
    • bug #67811 Fix ProgressBar::setMaxSteps() not updating the percentage (@nicolas-grekas)
    • bug #67805 Fix ProgressBar::start() computing the percentage against the previous max (@jack-worman)
    • bug #67769 Fix text ending with a backslash escaping the closing tag that follows it (@nicolas-grekas)
    • bug #67762 Keep an escaped tag delimiter with its backslash when wrapping text (@initd-it)
    • bug #67634 Fix setRow(), setColumnMaxWidth() and consecutive rowspans in Table (@nicolas-grekas)
    • bug #67633 Fix Table cells that span rows when they follow a cell that spans columns (@ybai08)

    [SECURITY] Security release

  4. v6.4.502026-11-04 · 2026-11-04 11:25 UTC
    查看更新说明

    Changelog (https://github.com/symfony/console/compare/v6.4.49...v6.4.50)

    • bug #67831 Fix ProgressBar's percent after finish() on undecorated output without a max (@nicolas-grekas)
    • bug #67830 Fix ProgressBar::finish() with a lowered max and restarting a finished bar without a max (@jack-worman)
    • bug #67823 Fix ProgressBar frames on undecorated output when resuming, restarting or finishing (@jack-worman)
    • bug #67811 Fix ProgressBar::setMaxSteps() not updating the percentage (@nicolas-grekas)
    • bug #67805 Fix ProgressBar::start() computing the percentage against the previous max (@jack-worman)
    • bug #67769 Fix text ending with a backslash escaping the closing tag that follows it (@nicolas-grekas)
    • bug #67762 Keep an escaped tag delimiter with its backslash when wrapping text (@initd-it)
    • bug #67634 Fix setRow(), setColumnMaxWidth() and consecutive rowspans in Table (@nicolas-grekas)
    • bug #67633 Fix Table cells that span rows when they follow a cell that spans columns (@ybai08)

    [EOM] End of maintenance release for branch 6.4 [SECURITY] Security release

  5. v8.1.102026-10-28 · 2026-10-28 18:25 UTC
    查看更新说明

    Changelog (https://github.com/symfony/console/compare/v8.1.9...v8.1.10)

    • bug #67575 Fix raw token stripping when an option value matches the command (@ahbaqdadi)
    • bug #67576 Don't format escaped tags again when sections measure their lines (@nicolas-grekas)
    • bug #67542 Fix style names with uppercase letters not being applied (@wfatih)
    • bug #67533 Fix Table header cells that span rows and escaped tags in TableCell (@nicolas-grekas)
    • bug #67523 Fix the alignment of wrapped Table cells and newlines around style tags (@nicolas-grekas)
    • bug #67522 Fix styles that leak out of Table cells (@nicolas-grekas)
    • bug #67507 Fix Helper::removeDecoration() keeping escaped > and trailing backslashes (@nicolas-grekas)
    • minor #67482 Fix two tests that fail on every 5.4 pull request (@nicolas-grekas)
    • bug #67386 Preserve temporary input files in forked processes (@nicolas-grekas)
    • bug #67373 Fix shell completion when a global option conflicts with an option of _complete (@lyrixx)
    • bug #67329 Fix StringInput dropping quotes inside a quoted option value (@mkantautas)
    • bug #67208 Support sections in TestOutput (@norkunas)
    • bug #67161 Fix invalid null device redirection on Windows (@laloona)
    • bug #67146 Fix locking a command again after acquiring its lock failed (@nicolas-grekas)
    • bug #67147 Lock an invokable command on the name of the command that runs it (@nicolas-grekas)
    • bug #67144 Stop a failed release from wedging the lock of a command (@HypeMC)
    • bug #67143 Lock an invokable command on its name alone, not on its aliases (@HypeMC)
    • bug #67132 Fix markdown tables with colspan cells or several header rows (@nicolas-grekas)
    • bug #67128 Always write a valid header and delimiter row in markdown tables (@ybai08)
    • bug #67092 Only rewrite the changed lines when appending a table row (@semx)
    • bug #67111 Fix several bugs when sections count the rows of their lines (@nicolas-grekas)
    • bug #67099 Fix clearing section lines that are wider than the terminal (@nicolas-grekas)
    • bug #67088 Fix hyperlinks next to a literal < or > (@nicolas-grekas)
    • bug #67039 Preserve ANSI sequences when wrapping output (@nicolas-grekas)
    • bug #66981 Fix two state bugs in OutputFormatterStyle (@nicolas-grekas)
    • bug #66971 Fix how sections count and redraw their lines (@nicolas-grekas)
    • bug #66942 Escape pipes and newlines in markdown tables (@lazerg)
    • bug #66943 Fix nested applications exiting on signals handled by the outer application (@nicolas-grekas)

    [SECURITY] Security release

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Console Component

    The Console component eases the creation of beautiful and testable command line interfaces.

    Sponsor

    This package is looking for a backer.

    Help Symfony by sponsoring its development!

    Resources

    Credits

    Resources/bin/hiddeninput.exe is a third party binary provided within this component. Find sources and license at https://github.com/Seldaek/hidden-input.