Hey, I'm Piotr and welcome to a different kind of PHP course.
We are skipping the boring theory and jumping straight into action.
In the next five minutes, we'll get the environment set up and you'll run your very first PHP program
on your own computer.
I'll show you how simple it is.
Ready?
Let's dive in.
To run PHP programs on your computer, you need to have PHP installed on it.
Historically, installing and setting up PHP was something that caused a lot of issues, especially
for beginners, but not only for beginners.
There were ready made packages like Samp and Vamp and those are still in use.
So if you have one of those, you should be set up already.
But I'd like to show you something new.
This PHP website has this one single command that should run an installation script that will get you
set up Setup with PHP and composer, and this essentially means everything that you need to develop
in PHP, and especially everything that you need to go through this course.
This command is available for Mac, for windows, and for Linux.
So let me follow the instructions for my system.
I'm just going to copy this command.
So I hit copy.
And next up I need to open spotlight and run the terminal.
You follow the instructions for your system.
So I'm typing terminal and the first thing I'm going to do is I will check if I have PHP already by
running PHP v.
I don't have it because I literally removed it minutes ago, so I can follow the instructions the same
way as you do.
Now let me paste this command and hit enter.
Well, I had something installed previously.
So it's asking me.
I confirm with yes, you probably would not be asked this question and now we just need to wait for
it to download the PHP binary and composer.
That should be pretty quick and we should have PHP available.
We might want to restart the terminal to make sure that this is applied.
And then let's run this php v again.
You should see that you have the recent PHP version installed.
So at this point we're already going to do some coding.
To code you need a code editor.
So grab Visual Studio Code or cursor.
Both come with some amount of built in AI features that might be available for free.
So I've already created the first PHP file you can create in any folder of your choice.
Every PHP file starts with PHP directive.
So guys, welcome in the world of PHP.
Let's already create something.
This would be super simple and remember you are not expected to understand it at this point.
We've got over 24 hours to go over the material.
The first let me introduce variables.
They start with a dollar followed by the name.
What a coincidence that our variable is actually called name.
And then we assign a value to it.
Let me do a fellow coder.
After every expression we need to add a semicolon.
This is extremely important.
You need to do it after every expression in PHP.
Then let's set some message.
Maybe something motivational.
The best way to predict the future is to create it.
And the semicolon at the end.
Let's fix the typo.
And now let's just put it on the screen.
You do it using the echo statement.
So let's just say hello to our fellow coder.
So I say hello.
This is just a static text.
But here I'm just going to put the value of the variable which would be the name and a new line character.
Next up, let me add another new line character and then say here is your fault for today.
Semicolon at the end.
And now the actual message.
And let's also add some separators at the end.
At the beginning.
Right, guys?
We are ready to run this.
As I've said this is super simple.
We can open the terminal inside Visual Studio Code.
This should be fine.
And the way we run PHP programs is we type PHP and the program name.
This is first dot PHP in our case.
And this is our output.
So we can fix some things like add a new line here and right here and try it again.
I think it is much nicer.
Maybe also a new line after the message itself.
So it really looks great right now.
So guys, you created your first PHP program.
I think that's pretty awesome.
And congratulations.
So next up in the course we're going to have around six hours of similar exercises.
That's gonna teach you the essentials of the PHP programming language.
This is for someone who never programmed at all and never programmed in PHP.
And then next up you are going to build four small, tiny projects that will teach you the essentials
of how PHP interacts with the web like forums, query parameters, sessions, and cookies.
And then we're going to build your first real project, the Guest Book.
We're going to create our own tiny framework.
So a set of reusable code.
But this one won't use object oriented programming only.
The second project, a blog with user sign in and admin panel, will use object oriented programming.
We're gonna create our own custom framework similar to Torre, Laravel.
Okay, one last thing.
Before we get going under every video, you will find a link to GitHub with all the source code for
that lesson.
If you get stuck, it's there, use it, compare your code with mine and figure out what's different.
It's the best way to learn.
Also, the very next lesson is just a text page.
I've dumped all the important links for the whole course there the projects, docs, everything, the
code editor, and all the links.
So it's all in the one place.
Okay guys.
That's it.
No more talking.
Let's start writing some code.
Next up in the course, we actually have a short 15 minute primer on the theory behind PHP.
You are free to skip that if you'd like.
And then we're focusing on learning.
So see each other in the next videos.