- How do I install league/climate with Composer?
- Run composer require league/climate from your project root and Composer will pull in the library and its polyfills. There are no required runtime dependencies beyond that, so no service provider registration or configuration file is needed. You then instantiate the CLImate class directly and start calling its methods.
- Does league/climate work with Laravel?
- Yes, but it is a framework-agnostic PHP library rather than a Laravel package, so it has no service container assumptions or framework coupling. In a Laravel codebase its strongest fit is standalone operational scripts, package-level CLIs, and internal tooling such as exports, backfills, and one-off maintenance runners. It can be autoloaded and used inside a Laravel app without any wrapper, and it sits comfortably as a leaf dependency below the application layer.
- Should I use CLImate inside Artisan commands or stick with Laravel Prompts?
- Inside Artisan commands you already have Symfony Console and Laravel Prompts, so introducing CLImate there creates overlapping terminal abstractions in a single command. The pragmatic rule is one command, one terminal abstraction: keep Artisan output on Laravel Prompts and reserve CLImate for scripts that live outside the framework's command layer. Mixing both in the same command is a smell that makes output behavior harder to reason about and test.
- Which PHP versions does league/climate support?
- PHP support has tracked upstream aggressively, with releases adding 8.1 support in 3.8.0, 8.2 and 8.3 in 3.9.0, 8.4 in 3.10.0, and 8.5 in 3.11.0. That means there is no PHP-version blocker for a modern Laravel stack. Check the release tags for the exact constraint if you are pinned to an older runtime.
- How do I add colors and text formatting to command-line output?
- CLImate exposes a fluent API where you call methods like red or blue with your text and it handles the ANSI escape codes for you, including 256-color support. You can chain decorators for bold, underline, background colors, and formatted blocks without constructing escape sequences manually. Tables, lists, and formatted blocks are also built in for structured output.
- How do I add a progress bar or spinner with CLImate?
- CLImate includes progress bars, spinners, and animations as part of its output surface, so you do not need a separate package for terminal feedback. They are driven through the same fluent API used for styled text, which keeps long-running scripts readable. This is particularly useful for imports, exports, and backfill scripts where you want visible progress without extra dependencies.
- How do I prompt users for input with league/climate?
- CLImate ships interactive prompts for confirmation, radio choices, checkboxes, password entry, and free-text input. Each prompt type returns the parsed result so you avoid hand-rolled readline handling in your scripts. Because these prompts block on STDIN, you should pair them with an explicit non-interactive code path for automated environments.
- How can I test CLImate output in CI?
- CLImate's output-writer abstraction supports stdout, stderr, a buffer, and a file, which is what makes terminal rendering assertable in automated tests. Pointing output at a buffer lets you assert on exact strings without capturing process output. That is the difference between a tested presentation layer and one that only gets eyeballed when someone runs the script.
- How do I stop interactive prompts from blocking CI, cron, or queued jobs?
- Anything that blocks on STDIN is a hazard in CI, cron, Docker without a TTY, and Laravel queue workers, so a mandatory non-interactive code path is required. Implement an explicit contract such as a --no-interaction flag, an environment variable, or TTY auto-detection, and route prompts through a wrapper that enforces it. Do not rely on the library to decide this for you; make the decision in your own integration layer.
- Is league/climate still maintained, and does it work in non-CLI contexts?
- The library was created by Joe Tannenbaum and is currently maintained by Craig Duncan under The League organization, with a semver-disciplined release history and multi-year steady patch releases, though the bus factor is a single named maintainer. Version 3.8.0 added a workaround for code executed in a non-CLI context, but CLImate still assumes a terminal, so avoid instantiating it from shared bootstraps, service providers, or queue workers that may run under FPM. Note also that its fluent, dynamically dispatched API limits IDE autocomplete and static analysis, so a typed internal facade is a reasonable mitigation if you rely on PHPStan or Psalm in CI.