Getting started with PHP: Essential dev tools

A complaint that I have with pretty much every programming language manual I’ve ever read, is that they almost never start by telling you how to get the tools you need. Sure, they tell you how to install the basic compiler or interpreter for the language, information you could easily discover by following the first Google result. But they don’t tell you where to find the tools that every experienced user knows about and uses every day, but which don’t come with the standard language distribution.

Today, as part of my ongoing notes on learning PHP, let’s talk about a few of those essential tools for PHP. I’m going to give Windows installation instructions, not because it’s my favorite, but because that’s the one platform most “how to install” pages seem to skimp on. If you’re on MacOS or Linux you should have no problem finding equivalent instructions.

Install PHP

First off, you need a PHP runtime. You can get this as part of an all-in-one package including a Web server, databasek, and the kitchen sink, such as XAMPP. But you don’t need all that just to start fiddling around code examples.

Using Chocolatey to install PHP is as simple as:

You should now have a command-line PHP executable.

Install Composer

Now you need a package manager in order to easily install open-source PHP libraries and tools. The de-facto PHP package manager is called composer. It is the equivalent to npm for JavaScript, Bundler for Ruby, or pip for Python.

Install PsySH

The last tool you need to easily play around with PHP code is a decent REPL. Technically PHP comes with one, the -a option, but it’s not what I’d call decent. Instead, install PsySH.

On Windows you’ll probably need to start a new terminal window before you can use the psysh command.


And that’s it for now: PHP, package manager, and REPL. If you know of any other “must-have” dev tools for PHP, let me know in the comments!