WEBVTT

00:00.280 --> 00:04.480
Hey, I'm Piotr and welcome to a different kind of PHP course.

00:04.800 --> 00:08.680
We are skipping the boring theory and jumping straight into action.

00:08.680 --> 00:13.960
In the next five minutes, we'll get the environment set up and you'll run your very first PHP program

00:13.960 --> 00:15.760
on your own computer.

00:16.160 --> 00:17.960
I'll show you how simple it is.

00:18.280 --> 00:19.000
Ready?

00:19.360 --> 00:20.360
Let's dive in.

00:22.400 --> 00:27.720
To run PHP programs on your computer, you need to have PHP installed on it.

00:28.200 --> 00:35.920
Historically, installing and setting up PHP was something that caused a lot of issues, especially

00:35.960 --> 00:39.320
for beginners, but not only for beginners.

00:39.880 --> 00:45.160
There were ready made packages like Samp and Vamp and those are still in use.

00:45.160 --> 00:49.120
So if you have one of those, you should be set up already.

00:49.640 --> 00:52.120
But I'd like to show you something new.

00:52.760 --> 01:00.400
This PHP website has this one single command that should run an installation script that will get you

01:00.400 --> 01:07.030
set up Setup with PHP and composer, and this essentially means everything that you need to develop

01:07.030 --> 01:12.110
in PHP, and especially everything that you need to go through this course.

01:12.630 --> 01:18.030
This command is available for Mac, for windows, and for Linux.

01:18.790 --> 01:21.590
So let me follow the instructions for my system.

01:22.110 --> 01:23.950
I'm just going to copy this command.

01:25.110 --> 01:26.270
So I hit copy.

01:26.270 --> 01:31.870
And next up I need to open spotlight and run the terminal.

01:32.070 --> 01:35.310
You follow the instructions for your system.

01:36.390 --> 01:45.830
So I'm typing terminal and the first thing I'm going to do is I will check if I have PHP already by

01:45.830 --> 01:47.270
running PHP v.

01:47.710 --> 01:54.670
I don't have it because I literally removed it minutes ago, so I can follow the instructions the same

01:54.670 --> 01:55.590
way as you do.

01:56.390 --> 01:58.910
Now let me paste this command and hit enter.

01:59.670 --> 02:02.260
Well, I had something installed previously.

02:02.260 --> 02:03.540
So it's asking me.

02:03.540 --> 02:10.260
I confirm with yes, you probably would not be asked this question and now we just need to wait for

02:10.260 --> 02:13.540
it to download the PHP binary and composer.

02:13.900 --> 02:18.460
That should be pretty quick and we should have PHP available.

02:20.460 --> 02:25.580
We might want to restart the terminal to make sure that this is applied.

02:27.740 --> 02:31.220
And then let's run this php v again.

02:31.900 --> 02:36.660
You should see that you have the recent PHP version installed.

02:38.940 --> 02:41.860
So at this point we're already going to do some coding.

02:42.020 --> 02:44.060
To code you need a code editor.

02:44.220 --> 02:47.180
So grab Visual Studio Code or cursor.

02:47.500 --> 02:54.740
Both come with some amount of built in AI features that might be available for free.

02:55.460 --> 03:03.170
So I've already created the first PHP file you can create in any folder of your choice.

03:04.410 --> 03:08.650
Every PHP file starts with PHP directive.

03:09.730 --> 03:13.090
So guys, welcome in the world of PHP.

03:13.890 --> 03:15.730
Let's already create something.

03:15.730 --> 03:20.930
This would be super simple and remember you are not expected to understand it at this point.

03:20.930 --> 03:24.490
We've got over 24 hours to go over the material.

03:25.010 --> 03:27.210
The first let me introduce variables.

03:27.490 --> 03:30.290
They start with a dollar followed by the name.

03:30.610 --> 03:34.890
What a coincidence that our variable is actually called name.

03:35.730 --> 03:38.290
And then we assign a value to it.

03:38.730 --> 03:41.770
Let me do a fellow coder.

03:42.090 --> 03:45.930
After every expression we need to add a semicolon.

03:46.130 --> 03:48.210
This is extremely important.

03:48.530 --> 03:52.090
You need to do it after every expression in PHP.

03:53.050 --> 03:55.890
Then let's set some message.

03:56.690 --> 03:58.530
Maybe something motivational.

03:58.570 --> 04:06.040
The best way to predict the future is to create it.

04:08.800 --> 04:10.480
And the semicolon at the end.

04:10.760 --> 04:12.160
Let's fix the typo.

04:13.480 --> 04:16.440
And now let's just put it on the screen.

04:16.440 --> 04:19.760
You do it using the echo statement.

04:20.560 --> 04:24.240
So let's just say hello to our fellow coder.

04:24.960 --> 04:26.120
So I say hello.

04:26.880 --> 04:28.440
This is just a static text.

04:28.440 --> 04:37.080
But here I'm just going to put the value of the variable which would be the name and a new line character.

04:39.720 --> 04:50.200
Next up, let me add another new line character and then say here is your fault for today.

04:52.600 --> 04:53.960
Semicolon at the end.

04:59.760 --> 05:02.040
And now the actual message.

05:04.200 --> 05:09.400
And let's also add some separators at the end.

05:09.440 --> 05:11.000
At the beginning.

05:12.200 --> 05:12.760
Right, guys?

05:12.760 --> 05:14.120
We are ready to run this.

05:14.320 --> 05:16.560
As I've said this is super simple.

05:16.960 --> 05:20.560
We can open the terminal inside Visual Studio Code.

05:20.720 --> 05:21.800
This should be fine.

05:22.080 --> 05:27.040
And the way we run PHP programs is we type PHP and the program name.

05:27.760 --> 05:30.480
This is first dot PHP in our case.

05:31.120 --> 05:33.880
And this is our output.

05:35.000 --> 05:44.600
So we can fix some things like add a new line here and right here and try it again.

05:45.880 --> 05:48.000
I think it is much nicer.

05:49.320 --> 05:52.520
Maybe also a new line after the message itself.

05:52.960 --> 05:55.240
So it really looks great right now.

05:56.800 --> 06:00.440
So guys, you created your first PHP program.

06:00.440 --> 06:02.190
I think that's pretty awesome.

06:02.190 --> 06:03.550
And congratulations.

06:04.070 --> 06:10.390
So next up in the course we're going to have around six hours of similar exercises.

06:10.390 --> 06:14.750
That's gonna teach you the essentials of the PHP programming language.

06:15.230 --> 06:21.190
This is for someone who never programmed at all and never programmed in PHP.

06:21.990 --> 06:27.990
And then next up you are going to build four small, tiny projects that will teach you the essentials

06:27.990 --> 06:34.230
of how PHP interacts with the web like forums, query parameters, sessions, and cookies.

06:34.550 --> 06:38.950
And then we're going to build your first real project, the Guest Book.

06:39.070 --> 06:41.790
We're going to create our own tiny framework.

06:42.110 --> 06:44.790
So a set of reusable code.

06:44.950 --> 06:48.550
But this one won't use object oriented programming only.

06:48.710 --> 06:57.270
The second project, a blog with user sign in and admin panel, will use object oriented programming.

06:57.310 --> 07:02.420
We're gonna create our own custom framework similar to Torre, Laravel.

07:03.340 --> 07:04.460
Okay, one last thing.

07:04.460 --> 07:13.020
Before we get going under every video, you will find a link to GitHub with all the source code for

07:13.260 --> 07:14.380
that lesson.

07:14.380 --> 07:21.980
If you get stuck, it's there, use it, compare your code with mine and figure out what's different.

07:22.180 --> 07:23.860
It's the best way to learn.

07:24.420 --> 07:27.540
Also, the very next lesson is just a text page.

07:27.540 --> 07:33.340
I've dumped all the important links for the whole course there the projects, docs, everything, the

07:33.340 --> 07:35.780
code editor, and all the links.

07:36.020 --> 07:37.740
So it's all in the one place.

07:38.460 --> 07:39.020
Okay guys.

07:39.060 --> 07:39.860
That's it.

07:39.900 --> 07:40.980
No more talking.

07:41.300 --> 07:43.060
Let's start writing some code.

07:43.620 --> 07:52.180
Next up in the course, we actually have a short 15 minute primer on the theory behind PHP.

07:52.500 --> 07:54.980
You are free to skip that if you'd like.

07:55.140 --> 07:57.460
And then we're focusing on learning.

07:59.660 --> 08:02.220
So see each other in the next videos.
