Chapter 18. PHP Command Line

Developers come to PHP from all sorts of backgrounds and with various levels of experience in software development. Regardless of whether you are a new computer science graduate, a seasoned developer, or someone from a noncoding field looking to learn a new skill, the forgiving nature of the language makes it easy to get started. That being said, the largest stumbling block for these noncoder beginners may be PHP’s command-line interface.

Noncoder beginners are likely to be comfortable with using a graphical user interface and navigating with a mouse and a graphical display. Give the same user a command-line terminal, and they might struggle with or be intimidated by the interface.

As a backend language, PHP is frequently manipulated at the command line. This potentially makes it an intimidating language for developers not accustomed to text-based interfaces. Fortunately, PHP-based command-line applications are relatively straightforward to build and immensely powerful to use.

An application might expose a command palette similar to its default RESTful interface, thus making interactions from a terminal similar to those over a browser or through an API. Yet another application might bury its administrative tooling in the CLI, protecting less technical end users from accidentally damaging the application.

One of the most popular PHP applications in the market today is WordPress, the open source blogging and web platform. Most users interact with the ...

Get PHP Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.