This beginners PHP course uses Laragon as a server and VS Code as a text editor. Laragon is far easier to use than Xampp. It generates apps and databases automatically, using Quick App. It also deals with creating a web address automatically (virtual hosts).
Setup the working environment
Set up Laragon
Once Laragon is installed, drag the icon from the hidden icons panel onto the taskbar. Next right-click on it and select Quick app>Blank name the project phptest. The site address will be http://phptest.test/.
Laragon works with your default browser, which is probably Edge, in Windows 10. Consequently, to change this, search for Default apps in the windows settings and change the default browser to the browser of your choice.
Virtual hosts and the root folder
Laragon places sites in a root folder, usually C/laragon/www this folder is used by the app creator. Laragon also deals with creating a virtual host or web address automatically. For example, the address will be of the form shown here http://phptest.test/ with the name of the site appended with .test.
Add phpmyadmin to laragon
This is not required now, but you can set it up for later.
Right-click on the Laragon icon in the taskbar and click on Tools>Quick Add>phpmyadmin, once installed the control panel will be at http://localhost/phpmyadmin/index.php login with root and no password
Set up VS code
Download Visual studio Code and install it.
There are a few extensions that will make your life easier. Click on the extension’s icon, see below, and search for PHP IntelliSense, then install it. You can also install the PHP extension pack and the HTML boilerplate.
Create a quick app and generate your first output.
Now for that first app.
In VS code click on file>Add folder to workspace and navigate to C:/laragon/www/phptest. This is the project folder set up earlier. Add this folder to VS Code.
Add a new file to the folder and name it index.php. Add the code shown below and navigate to http://phptest.test/. You should see the Help Text.
What is PHP?
In Part 2 we dive into the details of what PHP is and how to use it.