corex / terminal
此包已被废弃,不再维护。未建议替代包。
终端的类和辅助函数(基于league/climate + 一些扩展)
2.3.0
2020-05-02 20:09 UTC
Requires
- php: ^7.2
- corex/helpers: ^2.0
- league/climate: ^3.4
Requires (Dev)
- corex/debug: ^1.0
- phpunit/phpunit: ^7.5
- symfony/console: ^4.0 || ^5.0
This package is auto-updated.
Last update: 2023-09-16 10:33:30 UTC
README
此包使用league/climate包作为基础。增加了一些基本静态方法以方便访问。
可以在Console::class上设置Symfony输出。
轻松访问CLImate
可以通过singleton方法climate()轻松访问CLImate。有关CLImate的文档可以在https://climate.thephpleague.com/找到
$climate = Console::climate(); $climate->...
常用的静态方法。
// Get width of terminal. $width = Console::getTerminalWidth(); // Get height of terminal. $height = Console::getTerminalHeight(); // Show error message(s). Console::error($messages); // Show simple message(s) with no styling. Console::out($messages); // Show info message(s). Console::info($messages); // Show shout message(s). Console::shout($messages); // Show warning message(s) in cyan. Console::warning($messages); // Show table with option to set new headers. Console::table(array $rows, array $headers = []);
额外的静态方法。
// Show separator (default length = 80. Can be changed through setLineLength*). Console::separator($character = '-'); // Show header (title through ::info() followed by ::separator('=')). Console::header($title); // Show properties in a table with properties at the left. Console::properties(array $properties, $separator = ':'); // Show list of words (same as implode($separator, $words)). Console::words(array $words, $separator = ', ');
致谢
此包大量基于league团队(Extraordinary Packages联盟)开发者的出色工作。所有荣誉归功于他们。