LowercaseFormatter

February 9, 2026 · View on GitHub

The LowercaseFormatter converts strings to lowercase with proper UTF-8 character support for international text.

Usage

Basic Usage

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('HELLO WORLD');
// Outputs: "hello world"

Unicode Characters

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('CAFÉ FRANÇAIS');
// Outputs: "café français"

echo $formatter->format('コンニチハ');
// Outputs: "コンニチハ"

Mixed Content

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('HELLO WORLD 😊');
// Outputs: "hello world 😊"

API

LowercaseFormatter::__construct

  • __construct()

Creates a new lowercase formatter instance.

format

  • format(string $input): string

Converts the input string to lowercase using UTF-8 aware conversion.

Parameters:

  • $input: The string to convert to lowercase

Returns: The lowercase string

Examples

InputOutputDescription
HELLOhelloSimple ASCII text
CAFÉcaféLatin characters with accents
ПРИВЕТприветCyrillic text
コンニチハコンニチハJapanese text
HELLO 😊hello 😊Text with emoji
ÉÎÔÛéîôûMultiple accented characters

Notes

  • Uses mb_strtolower() for proper Unicode handling
  • Preserves accent marks and diacritical marks
  • Works with all Unicode scripts (Latin, Cyrillic, Greek, CJK, etc.)
  • Emoji and special symbols are preserved unchanged
  • Combining diacritics are properly handled
  • Numbers and special characters remain unchanged
  • Empty strings return empty strings