WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.106 --> 00:00:04.366 align:middle
Sprint back to your command
center (aka terminal).

00:00:04.786 --> 00:00:06.596 align:middle
This first tab is running the web server.

00:00:06.946 --> 00:00:08.896 align:middle
If you need to stop it, press Ctrl-C...

00:00:09.236 --> 00:00:14.486 align:middle
then restart it with: symfony serve We'll
leave that alone and let it do its thing.

00:00:15.056 --> 00:00:17.366 align:middle
Open a second terminal tab
in the same directory.

00:00:17.876 --> 00:00:21.136 align:middle
When we ran the symfony new
command, it downloaded a tiny project

00:00:21.196 --> 00:00:24.796 align:middle
and initialized a Git repository
with an initial commit.

00:00:25.226 --> 00:00:26.576 align:middle
That was super nice!

00:00:26.966 --> 00:00:32.366 align:middle
To see our files, I'm going to open this
directory in my favorite editor: PhpStorm.

00:00:32.626 --> 00:00:34.976 align:middle
More on this editor in a few minutes.

00:00:35.526 --> 00:00:39.306 align:middle
Right now, I want you to notice
just how small our project is!

00:00:39.826 --> 00:00:47.376 align:middle
To see the full list of committed files, back at
your terminal, run: git ls-files Yea, that's it.

00:00:47.686 --> 00:00:50.106 align:middle
Only about 15 files committed to git!

00:00:50.676 --> 00:00:51.376 align:middle
So then...

00:00:51.416 --> 00:00:53.226 align:middle
where the heck is Symfony?

00:00:53.746 --> 00:00:58.526 align:middle
One of our 15 files is especially
important: composer.json.

00:00:59.146 --> 00:01:01.326 align:middle
Composer is the package manager for PHP.

00:01:01.916 --> 00:01:07.096 align:middle
Its job is simple: read the package names
under this require key and download them.

00:01:07.096 --> 00:01:09.296 align:middle
When we ran the symfony new command,

00:01:09.546 --> 00:01:13.586 align:middle
it downloaded these 15 files
and also ran composer install.

00:01:14.126 --> 00:01:17.286 align:middle
That downloaded all of these
packages into the vendor/ directory.

00:01:17.856 --> 00:01:19.276 align:middle
So where is Symfony?

00:01:19.606 --> 00:01:21.746 align:middle
It's in vendor/symfony/...

00:01:22.176 --> 00:01:25.616 align:middle
and we're already using about
20 of its packages!

00:01:26.356 --> 00:01:28.376 align:middle
The vendor/ directory is not committed to git.

00:01:28.836 --> 00:01:32.456 align:middle
It's ignored thanks to another
file we started with: .gitignore.

00:01:33.116 --> 00:01:37.346 align:middle
This means that if a teammate clones our
project, they will not have this directory.

00:01:37.346 --> 00:01:38.496 align:middle
And that's okay!

00:01:38.946 --> 00:01:42.056 align:middle
We can always repopulate it
by running composer install.

00:01:42.616 --> 00:01:46.866 align:middle
Watch: I'll right-click and delete
the entire vendor/ directory.

00:01:47.416 --> 00:01:52.106 align:middle
Gasp! If we try our app now, it's busted.

00:01:52.286 --> 00:01:53.426 align:middle
Bad feels!

00:01:53.936 --> 00:01:59.656 align:middle
To fix it &amp; save the day, at your
terminal, run: composer install And...

00:01:59.986 --> 00:02:02.126 align:middle
presto! The directory is back....

00:02:02.426 --> 00:02:05.266 align:middle
and over here, the site works again.

00:02:05.996 --> 00:02:10.686 align:middle
Looking back at our files, there are only two
directories that we even need to think about.

00:02:11.036 --> 00:02:13.496 align:middle
The first is config/: this holds...

00:02:13.716 --> 00:02:14.796 align:middle
configuration!

00:02:15.266 --> 00:02:17.486 align:middle
We'll learn about what these
files do along the way.

00:02:18.186 --> 00:02:19.746 align:middle
The second is src/.

00:02:20.286 --> 00:02:22.586 align:middle
This is where all your PHP code will live.

00:02:23.066 --> 00:02:24.296 align:middle
And that's really it!

00:02:24.636 --> 00:02:29.226 align:middle
99% of the time you're either
configuring something or writing PHP code.

00:02:29.606 --> 00:02:31.426 align:middle
That happens in config/ &amp; src/.

00:02:31.956 --> 00:02:33.726 align:middle
What about the other 4 directories?

00:02:34.256 --> 00:02:39.126 align:middle
bin/ holds a single console executable
file that we'll try out soon.

00:02:39.636 --> 00:02:43.136 align:middle
But we're never going to
look at or modify that file.

00:02:43.786 --> 00:02:46.806 align:middle
The public/ directory is
known as your document root.

00:02:47.266 --> 00:02:51.096 align:middle
Anything you put here - like an
image - will be publicly accessible.

00:02:51.496 --> 00:02:53.266 align:middle
More about that stuff later.

00:02:53.766 --> 00:02:56.576 align:middle
It also holds index.php.

00:02:56.576 --> 00:03:00.076 align:middle
This is known as your "front
controller": it's the main PHP file

00:03:00.076 --> 00:03:03.346 align:middle
that your web server executes
at the start of every request.

00:03:03.846 --> 00:03:05.986 align:middle
And while it is super important...

00:03:06.256 --> 00:03:09.096 align:middle
you'll never edit or even think about this file.

00:03:09.856 --> 00:03:11.096 align:middle
Up next is var/.

00:03:11.456 --> 00:03:15.226 align:middle
This is also ignored from git:
it's where Symfony stores log files

00:03:15.226 --> 00:03:17.356 align:middle
and cache files that it needs internally.

00:03:17.736 --> 00:03:19.266 align:middle
So very important...

00:03:19.266 --> 00:03:21.336 align:middle
but not something we need to think about.

00:03:21.876 --> 00:03:23.726 align:middle
And we already talked about vendor/.

00:03:23.966 --> 00:03:24.856 align:middle
That's everything!

00:03:25.546 --> 00:03:28.956 align:middle
Now before we get coding, I
mentioned that I use PhpStorm.

00:03:29.396 --> 00:03:31.946 align:middle
You're free to use whatever editor you want.

00:03:32.436 --> 00:03:35.956 align:middle
However, PhpStorm is incredible.

00:03:36.356 --> 00:03:40.416 align:middle
And one big reason is the
unmatched Symfony plugin.

00:03:41.046 --> 00:03:45.846 align:middle
If you go to PhpStorm -&gt; Settings and search
for "Symfony", down here under Plugins

00:03:45.906 --> 00:03:48.176 align:middle
and then Marketplace, you can find it.

00:03:48.856 --> 00:03:51.876 align:middle
Download &amp; install the plugin
if you don't already have it.

00:03:51.996 --> 00:03:54.396 align:middle
After installation, restart PhpStorm.

00:03:54.956 --> 00:03:56.856 align:middle
Then there's one more step.

00:03:57.326 --> 00:03:59.966 align:middle
Go back into settings and
search for Symfony again.

00:04:00.546 --> 00:04:02.846 align:middle
This time you'll have a Symfony section.

00:04:03.386 --> 00:04:06.936 align:middle
Be sure to enable the plugin for
each Symfony project you work on...

00:04:07.266 --> 00:04:09.566 align:middle
otherwise you won't see all
the same magic I have.

00:04:10.406 --> 00:04:13.996 align:middle
Ok! Let's start coding and build
our first page in Symfony next.

