Using GitHub Codespaces for PHP Tutoring
Video
Prologue
I have been teaching PHP at the local university for the last 7 years — time really flies when you like what you are doing. Over the years we had to solve a lot of issues related to
- missing permissions to install software on computers (god mode..)
- old computers in the university causing a lot of issues
- students who did not have their own laptops and had to use the machines in the lab (which should be normal but it is not always the case..)
- various operating systems and possible issues — most of the students always use Windows but some like to make modifications.
We have always used XAMPP on Windows to teach them — I know that this is not a good idea and by using XAMPP they do not get to feel and understand how web servers are set up, but that’s life and we should focus on the actual programming language. “Give a Man a Fish, and You Feed Him for a Day. Teach a Man To Fish, and You Feed Him for a Lifetime”. I prefer to teach them to fish and then they start asking more and more valuable questions.
FFW Academy
For the last year, we have been tutoring students at our FFW Academy — ffwacademy.com. Github Codespaces proved to be a useful addition to our program and we actively used it for teaching.
Note: If you looking for a kickstart of your career in IT — try our academy. We have invested many hours into it and made in a way that once you finish the first BE course — you will be on a junior Drupal level.
Github Codespaces
“A codespace is a development environment that’s hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (often known as Configuration-as-Code), which creates a repeatable codespace configuration for all users of your project.” — you can find more information on the original website.
We have created the following repository https://github.com/FMI-VT/plain-php-codespace.
How to use it?
Fork — https://github.com/FMI-VT/plain-php-codespace
The final result of the fork should be
Start Codespace
Click on the “Code” button, then on the “Codespaces” tab. Once you are on the tab click on “Create codespace on main”
Once you see the screen above — usually it takes up to 2 minutes to have everything finished.
Note: If you are bored you could click on ‘View logs’ and see what are the options
Start server
If the creation of the Codespace is successful the expected screen is
We create a new file index.php
We add “Welcome to my first PHP environment!” and execute it in the terminal.
What about the server?
php -S 0.0.0.0:8080
If you run the above in the Terminal
Code space will automatically for you to find it and then offer you an option to click on “Open in Browser”
The final result is our code visible in the browser