Macrame is library for building interactive command line scripts in PHP.

Macrame was originally written as an internal project for Fruitbat Studios, Cloverhitch Technologies and Kludgetastic Implementations.

Features

With Macrame you can:

Output formatted and stylized text

Apply ANSI colours and styles to text using Macrame’s methods or custom tag system. Align text blocks in the terminal or wrap it to the terminal width on word breaks. Page long text output. docs

Handle command line arguments

Quickly access and test all command line arguments, switches and assignments. Handle duplicate switches and arguments so that things like -vvv and -v -v -v are treated the same. docs

Create interactive menus

Make interactive menus driven by arrow and tab keys; both vertical and horizontal. Apply custom styling and alignment to menus. There’s even a datepicker that behaves the way you think a datepicker should. docs

Read user input

Read a line of user input, or a key down event. Apply input validators to keep prompting until your user gives you good data. Echo dots if the input is sensitive, like passwords. Read data from STDIN so your script can accept piped input. docs

Do safer file reads and writes

Read and write files with easy handling of permissions and disk space errors. Set files to be automatically deleted when your script terminates. docs

Show spinners while your script does work in the background

Show an animated spinner while running a time-intensive function in the background. Choose from forty different spinner options. docs

Output data in ASCII tables

Display array data as an ASCII table, kind of like the ones MySql outputs. Set table border styles, configure column alignment and table alignment in the terminal. Newlines and tabs are automatically handled. docs

Download files with real progress bars

Download a file from an url and show the user a progress bar that actually tracks the download progress. docs

Build fancy figlet-style headlines

Create and output large headlines using figlet-style fonts. docs