<aside> <img src="/icons/light-bulb_gray.svg" alt="/icons/light-bulb_gray.svg" width="40px" /> Versão em português

Introdução à PHPCTL

</aside>

Who hasn't lost a few hours, or even days, setting up the computer to develop with PHP?

https://github.com/opencodeco/phpctl

In the early days, many people relied on solutions like LAMP, WAMP, XAMPP, etc. For those who are not familiar with that time, these were tool sets that came with Apache, MySQL, and PHP, and you would install them like any other program, with the famous "Next, next, next..." approach.

Over time, people stopped using these types of tools, especially with the advent of the built-in web server in PHP, so we no longer need to worry about setting up a web server like Apache or Nginx.

Furthermore, another proposal that emerged and is here to stay is the use of containers, which became very popular through the Docker tool (but there are other runtimes as well).

Containers

The use of containers was truly revolutionary, well known for putting an end to that infamous phrase "it works on my machine". After all, the main proposition of using containers was to standardize the execution and distribution of programs.

Nowadays, just like Git, it is an indispensable tool in any developer's arsenal, and it is no different for PHP developers.

With this in mind, considering the ease that containers bring and their widespread adoption, and after struggling with various ways of configuring PHP development environments, going through phpbrew, asdf, or even trying to manage with brew and apt directly, I decided to create phpctl.

PHPCTL

https://github.com/opencodeco/phpctl

The phpctl is entirely based on containers, which means you only need Docker installed on your machine and Git to install it by cloning the repository. When you run a command from phpctl, it runs a fully configured container that understands your current directory and uses an image with various commonly installed extensions.

Untitled

How to get started

I created an installation script that clones the repository and also creates links to the phpctl binaries in your /usr/local/bin directory, so you will already have access to commands like php and phpctl (among many others) directly from the terminal anywhere:

sh <(wget -qO- <https://raw.githubusercontent.com/opencodeco/phpctl/main/installer.sh>)

Once you install phpctl, you will also have composer, which is a package manager adopted by the PHP community.

Untitled

The command list is extensive, I recommend you take a look at the README.md of the project or use the help command to get a list of possible commands and a brief description of each one of them.