- What is knuckleswtf/pastel used for?
- Pastel is a lightweight PHP library for clean, colourful console output. It provides an expressive, chainable API for colours, backgrounds, and text attributes, plus helpers such as title(), section(), listing(), table(), and progressBar() over Symfony Console's ConsoleOutput. It is framework-agnostic and aimed at CLI scripts, status updates, and readable error messages.
- How do I install Pastel with Composer?
- Run composer require knuckleswtf/pastel and pin ^1.3. There is no service provider, config file, or publish step, so setup is effectively zero. Call Pastel::console() from a single place, ideally a small binding or facade, so it stays swappable and testable.
- Can I use Pastel in plain PHP scripts without Laravel?
- Yes. Pastel is framework-agnostic and works in any PHP CLI script with no Laravel bootstrapping, which is its main differentiator. Use it for standalone installer, ops, or deploy helpers rather than mixing it with Artisan component output in the same code path.
- Does Pastel work inside Laravel Artisan commands?
- It can, but it is not recommended for new Artisan command output. Pastel::console() returns a singleton bound to real stdout with fixed verbosity and decoration, so it does not inherit an Artisan command's -q, -v, or --no-ansi flags. Inside commands, use $this->output or $this->components instead.
- Which Laravel and PHP versions does Pastel support?
- Pastel itself has no Laravel version constraint because it is framework-agnostic. It requires PHP, and named arguments such as ask(question: ..., default: ...) need PHP 8; on PHP 7.x pass those arguments positionally. Check the locked symfony/console version in each target application.
- Which symfony/console versions is Pastel compatible with?
- Symfony Console is Pastel's real compatibility surface, and the package has not been updated since 2021. Verify against the exact symfony/console major locked in your app, not the declared range. Drift can cause undefined tags to render literally or throw, so this is the highest-probability breakage point.
- Is Pastel still maintained?
- Pastel is archived, and its last release was 2021-03-27. There are no upstream fixes or security patches, so treat it as a small, stable, presentation-only dependency. If you need changes, plan to fork and own the wrapper internally.
- What license does Pastel use?
- The declared license is NOASSERTION, so legal or compliance review is required before distribution or open-source-adjacent use. Confirm the actual LICENSE file and composer.json declaration before adoption. This should be a gate before any pilot work.
- How do I test code that uses Pastel?
- Pastel writes directly to stdout, so assertions based on Artisan::output()-style capture will not see it. Inject a BufferedOutput test double, or extract formatting into string-returning methods you can assert on. Bind ConsoleOutput in one place so the double and a future swap are trivial.
- How does Pastel compare to Laravel Prompts and $this->components?
- There is heavy overlap: Laravel 9+ $this->components offers title, listing, twoColumnDetail, progressBar, and table, while Laravel Prompts covers interactivity. Pastel is a styling choice, not a capability gap. Mixing both styles in one codebase produces inconsistent spacing and should be treated as an anti-pattern.