WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:01.146 --> 00:00:05.546 align:middle
Our mission: to boldly go
where no one has gone before...

00:00:06.046 --> 00:00:08.626 align:middle
by checking out our app!

00:00:08.626 --> 00:00:15.146 align:middle
I already opened the new directory in PhpStorm,
so fire up your tricorder and let's explore!

00:00:15.976 --> 00:00:18.796 align:middle
There are only three directories
you need to think about.

00:00:18.796 --> 00:00:25.496 align:middle
First, public/ is the document root: so it
will hold all publicly accessible files.

00:00:26.206 --> 00:00:28.666 align:middle
And... there's just one right now!

00:00:29.176 --> 00:00:30.866 align:middle
index.php.

00:00:30.866 --> 00:00:36.796 align:middle
This is the "front controller": a fancy
word programmers invented that means

00:00:36.906 --> 00:00:41.966 align:middle
that this is the file that's
executed when you go to any URL.

00:00:42.846 --> 00:00:46.266 align:middle
But, really, you'll almost
never need to worry about it.

00:00:46.616 --> 00:00:51.346 align:middle
In fact, now that we've talked about
this directory, stop thinking about it!

00:00:52.006 --> 00:00:53.266 align:middle
Yea, I lied!

00:00:53.716 --> 00:01:00.536 align:middle
There are truly only two directories you
need to think about: config/ and src/.

00:01:01.656 --> 00:01:02.856 align:middle
config/ holds...

00:01:02.856 --> 00:01:03.716 align:middle
um... ya know...

00:01:03.716 --> 00:01:10.016 align:middle
config files and src/ is where
you'll put all your PHP code.

00:01:11.006 --> 00:01:12.656 align:middle
It's just that simple.

00:01:13.746 --> 00:01:14.706 align:middle
Where is Symfony?

00:01:15.166 --> 00:01:20.476 align:middle
As usual, when we created the project,
Composer read our composer.json file

00:01:20.766 --> 00:01:23.536 align:middle
and downloaded all the third-party libraries -

00:01:23.906 --> 00:01:27.336 align:middle
including parts of Symfony -
into the vendor/ directory.

00:01:28.636 --> 00:01:31.436 align:middle
Go back to your terminal
and find the original tab.

00:01:33.236 --> 00:01:38.486 align:middle
Check this out: at the bottom, it says
that we can get a better web server

00:01:38.746 --> 00:01:40.916 align:middle
by running composer require server.

00:01:41.636 --> 00:01:43.506 align:middle
I like better stuff!

00:01:43.506 --> 00:01:44.246 align:middle
So let's try it!

00:01:45.076 --> 00:01:50.876 align:middle
Press Ctrl+C to stop the existing server,
and then run: composer require server

00:01:52.406 --> 00:01:54.836 align:middle
If you're familiar with Composer...

00:01:55.236 --> 00:01:57.756 align:middle
that package name should look funny!

00:01:58.216 --> 00:01:59.426 align:middle
Really, wrong!

00:02:00.546 --> 00:02:07.846 align:middle
Normally, every package name is "something"
slash "something", like symfony/console.

00:02:07.966 --> 00:02:12.586 align:middle
So... server just should not work!

00:02:13.156 --> 00:02:14.586 align:middle
But it does!

00:02:15.276 --> 00:02:18.256 align:middle
This is part of a cool new system called Flex.

00:02:18.716 --> 00:02:19.856 align:middle
More about that soon!

00:02:20.806 --> 00:02:22.606 align:middle
When this finishes, you can now run: .

00:02:22.836 --> 00:02:29.146 align:middle
/bin/console server:run This does
basically the same thing as before...

00:02:29.356 --> 00:02:30.586 align:middle
but the command is shorter.

00:02:31.586 --> 00:02:34.626 align:middle
And when we refresh, it still works!

00:02:34.626 --> 00:02:41.176 align:middle
By the way, this bin/console command
is going to be our new robot side-kick.

00:02:41.876 --> 00:02:47.606 align:middle
But it's not magic: our project has a
bin/ directory with a console file inside.

00:02:48.606 --> 00:02:52.256 align:middle
Windows users should say php bin/console...

00:02:52.446 --> 00:02:54.326 align:middle
because it's just a PHP file.

00:02:55.226 --> 00:02:59.316 align:middle
So, what amazing things can
this bin/console robot do?

00:02:59.426 --> 00:03:02.666 align:middle
Find your open terminal tab and just run: .

00:03:03.056 --> 00:03:05.246 align:middle
/bin/console Yes!

00:03:05.506 --> 00:03:09.176 align:middle
This is a list of all of
the bin/console commands.

00:03:10.296 --> 00:03:12.996 align:middle
Some of these are debugging gold.

00:03:13.616 --> 00:03:15.336 align:middle
We'll talk about them along the way!

00:03:16.386 --> 00:03:19.626 align:middle
Ok, we are almost ready to start coding!

00:03:20.246 --> 00:03:24.816 align:middle
But we need talk about our
spaceship, I mean, editor!

00:03:25.616 --> 00:03:28.996 align:middle
Look, you can use whatever your want...

00:03:29.226 --> 00:03:31.666 align:middle
but... I highly recommend PhpStorm!

00:03:32.516 --> 00:03:36.266 align:middle
Seriously, it makes developing
in Symfony a dream!

00:03:37.076 --> 00:03:41.976 align:middle
And no, those nice guys &amp; gals at
PhpStorm aren't paying me to say this...

00:03:42.286 --> 00:03:43.686 align:middle
but they can if the want to!

00:03:43.686 --> 00:03:46.236 align:middle
Ahem, If you do use it...

00:03:46.506 --> 00:03:48.316 align:middle
which would be awesome for you...

00:03:48.776 --> 00:03:54.176 align:middle
there are 2 secrets you need to know to
trick out your spaceship, ah, editor!

00:03:54.696 --> 00:03:57.396 align:middle
Clearly I was in hyper-sleep too long.

00:03:57.956 --> 00:04:03.906 align:middle
Go to Preferences, Plugins, then
click "Browse Repositories".

00:04:05.636 --> 00:04:08.256 align:middle
There are 3 must-have plugins.

00:04:09.076 --> 00:04:10.036 align:middle
Search for "Symfony".

00:04:11.246 --> 00:04:13.206 align:middle
First: the "Symfony Plugin".

00:04:13.966 --> 00:04:17.016 align:middle
It has over 2 million downloads for a reason:

00:04:17.516 --> 00:04:21.566 align:middle
it will give you tons of
ridiculous auto-completion.

00:04:22.466 --> 00:04:26.166 align:middle
You should also download "PHP
Annotations" and "PHP Toolbox".

00:04:27.006 --> 00:04:28.826 align:middle
I already have them installed.

00:04:28.856 --> 00:04:33.996 align:middle
If you don't, you'll see an "Install"
button right at the top of the description.

00:04:34.576 --> 00:04:38.156 align:middle
Install those and restart PHPStorm.

00:04:38.156 --> 00:04:43.966 align:middle
Then, come back to Preferences, search for
"symfony" and find the new "Symfony" section.

00:04:45.336 --> 00:04:51.236 align:middle
Click the "Enable Plugin" checkbox: you need
to enable the Symfony plugin for each project.

00:04:52.216 --> 00:04:53.996 align:middle
It says you need to restart...

00:04:54.066 --> 00:04:55.956 align:middle
but I think that's lie.

00:04:56.526 --> 00:04:57.386 align:middle
It's space!

00:04:57.606 --> 00:04:58.496 align:middle
What could go wrong?

00:05:00.086 --> 00:05:02.526 align:middle
So that's PhpStorm trick #1.

00:05:02.626 --> 00:05:07.836 align:middle
For the second, search "Composer"
and click on the "Composer" section.

00:05:09.136 --> 00:05:14.056 align:middle
Click to browse for the "Path to composer.json"
and select the one in our project.

00:05:14.846 --> 00:05:17.126 align:middle
I'm not sure why this isn't automatic...

00:05:17.166 --> 00:05:18.306 align:middle
but whatever!

00:05:18.306 --> 00:05:23.686 align:middle
Thanks to this, PhpStorm will make
it easier to create classes in src/.

00:05:24.016 --> 00:05:25.986 align:middle
You'll see this really soon.

00:05:27.226 --> 00:05:30.706 align:middle
Okay! Our project is set up
and it's already working.

00:05:30.706 --> 00:05:35.866 align:middle
Let's start building some pages and
discovering more cool things about new app.

