macrame

php: writing command-line applications with macrame

php doesn’t get a lot of attention as a command line scripting language. which is a shame, since php has a lot of features that make it a good choice for writing terminal apps.

in this series, we’ll be going over writing interactive command line scripts using the macrame library. we’ll be working through building an example project, a script that fetches a list of a mastodon user’s followers, from start to end, and will cover topics such as getting and validating user input, building interactive menus, handling command line arguments, accessing files safely, styling output text, and running functions in the background while showing our users an animated spinner.

further information on macrame can be found on the documentation site.

the sample project

the project we will be working through is a simple command-line script that returns a list of a mastodon user’s followers. running it looks like this:

Continue reading →