The Workshop:
Easy CLI PHP with Symfony Console 5

By Joe Ferguson

Writing console commands with PHP is something I have always taken for granted. I started my career having learned Linux and command line server configuration and was very comfortable writing small applications with BASH scripts, Python, and even dabbling in C and Microsoft Qbasic. These commands copied files to a backup location, process batched data records in CSV, XML, and various other formats. By the time I discovered PHP, the community had just seen early builds of PHP 5, and the entire ecosystem was in for a shock. Once comfortable with PHP, I began writing small CLI commands in PHP instead of Python (or BASH). It was quite liberating to flex the same language for both web and command line applications.

This article was originally published in the April 2020 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.

Leave a comment

Use the form below to leave a comment: