2 Methods to Disable ANSI Color Escape Codes for Composer

2 Methods to Disable ANSI Color Escape Codes for Composer

Composer displays colored output in the terminal by default through ANSI escape codes. While this improves readability for many developers, there are situations where plain text output is preferred. This tutorial provides 2 methods how to disable ANSI color escape codes for Composer.

Method 1 - no-ansi option

Composer provides a built-in --no-ansi option that disables colored output. The option is available with every Composer command. For example, when executing the install command:

composer --no-ansi install

Method 2 (Linux) - NO_COLOR before command

Another approach is to set the NO_COLOR environment variable for the current command invocation. Composer detects this variable and produces plain text output.

NO_COLOR=1 composer install

Leave a Comment

Cancel reply

Your email address will not be published.