WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:00.056 --> 00:00:03.796 align:middle
Hey friends!

00:00:04.066 --> 00:00:07.376 align:middle
And welcome to the world of Symfony 5...

00:00:07.676 --> 00:00:10.916 align:middle
which just happens to be my favorite world!

00:00:11.646 --> 00:00:15.036 align:middle
Ok, maybe Disney World is my favorite world...

00:00:15.426 --> 00:00:18.246 align:middle
but programming in Symfony 5 is a close second.

00:00:18.666 --> 00:00:23.646 align:middle
Symfony 5 is lean and mean: it's
lightning fast, starts tiny,

00:00:24.036 --> 00:00:27.016 align:middle
but grows with you as your app gets bigger.

00:00:27.516 --> 00:00:29.516 align:middle
And that's not marketing jargon!

00:00:29.926 --> 00:00:34.736 align:middle
Your Symfony app will literally
grow as you need more features.

00:00:35.066 --> 00:00:37.026 align:middle
But more on that later.

00:00:37.736 --> 00:00:43.566 align:middle
Symfony 5 is also the product of
years of work on developer experience.

00:00:44.266 --> 00:00:52.026 align:middle
Basically, the people behind Symfony want you to
love using it but without sacrificing quality.

00:00:52.826 --> 00:00:58.436 align:middle
Yep, you get to write code that you're proud
of, love the process, and build things quickly.

00:00:59.136 --> 00:01:04.456 align:middle
Symfony is also the fastest major PHP
framework, which is no surprise: -

00:01:04.886 --> 00:01:09.236 align:middle
its creator also created the
PHP profiling system Blackfire.

00:01:09.726 --> 00:01:12.376 align:middle
So... performance is always a focus.

00:01:13.216 --> 00:01:14.596 align:middle
So... let's do this!

00:01:15.136 --> 00:01:18.576 align:middle
Start off by going to http://symfony.com
and clicking "Download".

00:01:19.326 --> 00:01:22.806 align:middle
What we're about to download
is not actually Symfony.

00:01:23.416 --> 00:01:28.176 align:middle
It's an executable tool that will help
make local development with Symfony...

00:01:28.486 --> 00:01:29.706 align:middle
well.. awesome.

00:01:30.776 --> 00:01:33.826 align:middle
Because I'm on a Mac, I'll copy this command

00:01:33.826 --> 00:01:37.946 align:middle
and then go open a terminal
- I already have one waiting.

00:01:38.996 --> 00:01:41.996 align:middle
It doesn't matter where on
your filesystem you run this.

00:01:42.756 --> 00:01:50.616 align:middle
Paste! This downloads a single executable file
and, for me, puts it into my home directory.

00:01:51.506 --> 00:01:55.816 align:middle
To make it so that I can run this
executable from anywhere on my system,

00:01:56.256 --> 00:02:01.636 align:middle
I'll follow the command's advice and
move the file somewhere else: Ok, try it!

00:02:01.936 --> 00:02:05.666 align:middle
symfony It's alive!

00:02:06.316 --> 00:02:11.626 align:middle
Say hello to the Symfony CLI: a
command-line tool that will help us

00:02:11.626 --> 00:02:15.856 align:middle
with various things along our
path to programming glory.

00:02:16.866 --> 00:02:21.406 align:middle
Its first job will be to help us
create a new Symfony 5 project.

00:02:21.856 --> 00:02:25.686 align:middle
Run: symfony new cauldron_overflow

00:02:26.686 --> 00:02:31.656 align:middle
Where cauldron_overflow will be the
directory that the new app will live in.

00:02:32.216 --> 00:02:35.196 align:middle
This also happens to be the name
of the site we're building...

00:02:35.416 --> 00:02:37.136 align:middle
but more on that later.

00:02:37.576 --> 00:02:41.176 align:middle
Behind the scenes, this command
isn't doing anything special:

00:02:41.616 --> 00:02:47.536 align:middle
it clones a Git repository called
symfony/skeleton and then uses Composer

00:02:47.586 --> 00:02:49.916 align:middle
to install that project's dependencies.

00:02:50.386 --> 00:02:54.156 align:middle
We'll talk more about that
repository and Composer a bit later.

00:02:55.186 --> 00:02:59.896 align:middle
When it's done, move into the new
directory: cd cauldron_overflow

00:03:00.896 --> 00:03:04.056 align:middle
And then open this directory
in your favorite editor.

00:03:04.936 --> 00:03:11.796 align:middle
I already have it open in my favorite: PhpStorm,
which I did by going to File -&gt; Open Directory

00:03:12.026 --> 00:03:13.966 align:middle
and selecting the new project folder.

00:03:15.006 --> 00:03:22.346 align:middle
Anyways, say hello to your brand new, shiny,
full-of-potential new Symfony 5 project.

00:03:22.906 --> 00:03:27.526 align:middle
Before we start hacking away at things,
let's create a new git repository and commit.

00:03:28.126 --> 00:03:29.136 align:middle
But wait...

00:03:29.476 --> 00:03:34.276 align:middle
run: git status On branch
master, nothing to commit.

00:03:35.076 --> 00:03:40.706 align:middle
Surprise! The symfony new command
already initialized a git repository

00:03:40.966 --> 00:03:43.166 align:middle
for us and made the first commit.

00:03:43.406 --> 00:03:48.866 align:middle
You can see it by running: git
log Add initial set of files Nice!

00:03:49.126 --> 00:03:54.896 align:middle
Though, I personally would have liked a
slightly more epic first commit message...

00:03:55.026 --> 00:03:56.196 align:middle
but that's fine.

00:03:56.706 --> 00:03:58.636 align:middle
I'll hit "q" to exit this mode.

00:03:59.486 --> 00:04:02.426 align:middle
I mentioned earlier that Symfony starts small.

00:04:02.936 --> 00:04:07.186 align:middle
To prove it, we can see a list of
all the files that were committed

00:04:07.386 --> 00:04:12.146 align:middle
by running: git show -- name-only Yea...

00:04:12.486 --> 00:04:13.796 align:middle
that's it!

00:04:13.796 --> 00:04:21.346 align:middle
Our project - which is fully set up and ready
to leverage Symfony - is less than 15 files...

00:04:21.806 --> 00:04:24.046 align:middle
if you don't count things like .gitignore.

00:04:24.596 --> 00:04:25.946 align:middle
Lean and mean.

00:04:26.596 --> 00:04:30.356 align:middle
Let's hook up a web server to
our app and see it in action!

00:04:30.356 --> 00:04:35.136 align:middle
First, make sure your computer has
everything Symfony needs by running:

00:04:35.396 --> 00:04:40.056 align:middle
symfony check:req For check requirements.

00:04:40.806 --> 00:04:45.856 align:middle
We're good - but if you have any issues and need
help fixing them, let us know in the comments.

00:04:46.456 --> 00:04:50.146 align:middle
To actually get the project
running, look back in PhpStorm.

00:04:50.846 --> 00:04:53.316 align:middle
We're going to talk more
about each directory soon.

00:04:53.826 --> 00:04:59.886 align:middle
But the first thing you need to know is that
the public/ directory is the "document root".

00:05:00.376 --> 00:05:03.176 align:middle
This means that you need
to point your web server -

00:05:03.456 --> 00:05:06.626 align:middle
like Apache or Nginx - at this directory.

00:05:07.156 --> 00:05:09.066 align:middle
Symfony has docs on how to do that.

00:05:09.766 --> 00:05:15.386 align:middle
But! To keep life simple, instead of setting
up a real server on our local machine,

00:05:15.686 --> 00:05:18.516 align:middle
we can use PHP's built-in web server.

00:05:19.036 --> 00:05:29.486 align:middle
At the root of your project, run: php -S
127.0.0.1:8000 -t public/ As soon as we do that,

00:05:30.036 --> 00:05:36.356 align:middle
we can spin back over to our browser and
go to http://localhost:8000 to find...

00:05:36.716 --> 00:05:38.626 align:middle
Welcome to Symfony 5!

00:05:39.126 --> 00:05:40.246 align:middle
Ooh, fancy!

00:05:41.606 --> 00:05:45.056 align:middle
Next: as easy as it was to
run that PHP web server,

00:05:45.456 --> 00:05:49.446 align:middle
I'm going to show you an even
better option for local development.

00:05:50.266 --> 00:05:56.136 align:middle
Then we'll get to know the significance of
the directories in our new app and make sure

00:05:56.136 --> 00:05:59.236 align:middle
that we have a few plugins
installed in PhpStorm...

00:05:59.656 --> 00:06:03.366 align:middle
which... make working with
Symfony an absolute pleasure.

