CLI is a small library to wrap all the needed informations to build a command line tool. The idea to build this came while reading the ponylang documentation realising that other languages use a similar approach for the entry point of the app, so I decided to have something similar for PHP.
The said approach is to have a main
function as the starting point of execution of your code. This function has a the environment it runs in passed as argument so there's no need for global variables. However since not everything can be passed down as argument (it would complicate the interface), ambient authority can be exercised (as in regular PHP script).
Important
To correctly use this library you must validate your code with vimeo/psalm
composer require innmind/cli
Documentation can be found at https://innmind.org/CLI/.