Skip to content

glhd/ansipants

Repository files navigation

ANSI Pants 👖💫

Installation

composer require glhd/ansipants

Usage

You can instantiate a new ANSI string using the ansi() helper, with new AnsiString(), or with AnsiString::make(). All string manipulation functions can be chained, just like the Laravel Stringable class. Where appropriate, you can pass an additional ignore_style: true argument into a function to make that function ignore the ANSI styles that are applied (like color or font style).

An example:

ansi("\e[1mHello💥 \e[3mwo\e[0mrld")
  ->append(" 🥸🥸🥸")
  ->padLeft(100)
  ->wordwrap();

Stringable Macro

You can also create an ANSI string from any Stringable object:

Str::of("\e[1mHello💥 \e[3mwo\e[0mrld")->ansi();
// Or
str("\e[1mHello💥 \e[3mwo\e[0mrld")->ansi();

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages