WEBVTT

NOTE Created by CaptionSync from Automatic Sync Technologies www.automaticsync.com

00:00:00.036 --> 00:00:02.296 align:middle
Symfony 7.4?

00:00:02.496 --> 00:00:04.196 align:middle
Check. Deprecation-free?

00:00:04.386 --> 00:00:07.976 align:middle
Check. Nice, it's finally
time to upgrade to Symfony 8!

00:00:07.976 --> 00:00:10.586 align:middle
Thankfully, we've done most
of the hard work already,

00:00:10.586 --> 00:00:12.976 align:middle
so the upgrade process should
be straightforward.

00:00:12.976 --> 00:00:16.206 align:middle
Let's get started by opening
our composer.json file.

00:00:16.826 --> 00:00:19.566 align:middle
We'll do the same thing we
did when upgrading to 7.4.

00:00:20.056 --> 00:00:21.446 align:middle
Edit... Find...

00:00:21.756 --> 00:00:22.466 align:middle
Replace...

00:00:22.716 --> 00:00:27.166 align:middle
7.4.* and replace it with 8.0.

00:00:28.276 --> 00:00:28.996 align:middle
*. Replace all...

00:00:29.676 --> 00:00:32.106 align:middle
Nice. I'll take a moment to verify.

00:00:32.626 --> 00:00:33.986 align:middle
require section looks good...

00:00:35.916 --> 00:00:39.576 align:middle
Ah, great, our extra symfony
require option was updated.

00:00:39.836 --> 00:00:41.326 align:middle
And require-dev looks good too!

00:00:42.006 --> 00:00:43.546 align:middle
Head over to the terminal and run:

00:00:43.546 --> 00:00:49.046 align:middle
symfony composer update Ooo, an
error, let's scroll up a bit.

00:00:49.846 --> 00:00:56.436 align:middle
Ok, our root composer.json requires
symfonycasts/tailwind-bundle ^0.9.0.

00:00:57.026 --> 00:01:00.256 align:middle
This bundle requires some Symfony
packages, but unfortunately,

00:01:00.256 --> 00:01:02.446 align:middle
Symfony 8 versions aren't supported.

00:01:02.976 --> 00:01:04.406 align:middle
Let's see if there's an updated version.

00:01:04.936 --> 00:01:07.566 align:middle
Over in the browser, go to packagist.org.

00:01:07.566 --> 00:01:09.336 align:middle
Search for tailwind-bundle...

00:01:10.256 --> 00:01:10.796 align:middle
Here it is.

00:01:11.926 --> 00:01:17.506 align:middle
On the right here, are all the versions,
select v0.9.0, the version we're on.

00:01:18.006 --> 00:01:22.036 align:middle
Sure enough, Symfony packages it
requires only support up to Symfony 7.

00:01:22.656 --> 00:01:28.376 align:middle
Here's the newest version: v0.12.0, and
sweet, this one does support Symfony 8!

00:01:28.986 --> 00:01:30.516 align:middle
Back in our composer.json...

00:01:30.516 --> 00:01:32.036 align:middle
find the tailwind-bundle...

00:01:32.106 --> 00:01:37.886 align:middle
and change its version to ^0.12.0:
Let's try the update again.

00:01:40.106 --> 00:01:41.466 align:middle
Huh, another error.

00:01:41.926 --> 00:01:42.826 align:middle
Let's see what's going on.

00:01:43.236 --> 00:01:46.966 align:middle
Our composer.json requires monolog-bundle ^3.0,

00:01:47.236 --> 00:01:50.676 align:middle
but it seems monolog-bundle
3 doesn't support Symfony 8.

00:01:50.676 --> 00:01:54.546 align:middle
Let's quickly jump back to Packagist
and search for monolog-bundle.

00:01:58.886 --> 00:02:01.346 align:middle
Yep, version 3 doesn't support Symfony 8...

00:02:01.506 --> 00:02:02.836 align:middle
but version 4 does!

00:02:03.606 --> 00:02:06.636 align:middle
Back to composer.json, find
the monolog-bundle...

00:02:06.896 --> 00:02:17.376 align:middle
and change its version to ^4.0:
Will the third update be the charm?

00:02:17.376 --> 00:02:20.596 align:middle
Perfect! It worked this time!

00:02:21.236 --> 00:02:31.306 align:middle
Let's confirm by running: symfony
console -- version Excellent!

00:02:31.416 --> 00:02:33.296 align:middle
Symfony 8.0.10!

00:02:34.056 --> 00:02:36.096 align:middle
Now let me show you a handy
composer command that checks

00:02:36.096 --> 00:02:38.116 align:middle
if you have any outdated dependencies.

00:02:38.286 --> 00:02:40.936 align:middle
That's dependencies that have
newer versions available.

00:02:40.936 --> 00:02:49.926 align:middle
symfony composer outdated -D The -D option
stands for direct dependencies, which means,

00:02:49.926 --> 00:02:53.446 align:middle
only the packages that are in
our app's composer.json file.

00:02:53.726 --> 00:02:57.896 align:middle
Not transitive dependencies, which are
the dependencies of our dependencies.

00:02:58.256 --> 00:03:00.136 align:middle
I only really care about the direct ones.

00:03:00.676 --> 00:03:03.556 align:middle
Looks like we have 3 packages that
have newer versions available.

00:03:03.556 --> 00:03:08.096 align:middle
phpdocumentor/reflection-docblock,
symfony/stimulus-bundle

00:03:08.366 --> 00:03:12.306 align:middle
and symfony/ux-turbo can all be
upgraded to the next major version.

00:03:12.686 --> 00:03:15.216 align:middle
Let's go ahead and do that
in our composer.json file.

00:03:15.216 --> 00:03:20.766 align:middle
Find phpdocumentor/reflection-docblock
and change to ^6.0.

00:03:21.456 --> 00:03:24.906 align:middle
Next, stimulus-bundle, change to ^3.0.

00:03:24.906 --> 00:03:30.286 align:middle
Finally, ux-turbo, change to ^3.0: Let's update!

00:03:33.196 --> 00:03:33.876 align:middle
Excellent!

00:03:33.986 --> 00:03:38.266 align:middle
No errors means there are no conflicts with
the upgraded packages, so we're good to go.

00:03:38.976 --> 00:03:43.466 align:middle
Running git status confirms that it's
only our composer.lock, composer.json,

00:03:43.616 --> 00:03:46.146 align:middle
and reference.php files that have changed.

00:03:46.586 --> 00:03:49.856 align:middle
Remember, that reference.php file helps your IDE

00:03:49.856 --> 00:03:53.306 align:middle
with array-based Symfony
configuration and is auto-generated.

00:03:53.766 --> 00:03:56.206 align:middle
We can ignore it as we use YAML-based config.

00:03:56.826 --> 00:04:03.526 align:middle
Commit our changes with: git commit
-a -m "upgrade to Symfony 8!"

00:04:04.636 --> 00:04:08.346 align:middle
Hmm, the terminal didn't like my
enthusiasm with the exclamation point...

00:04:08.826 --> 00:04:11.846 align:middle
I'll cancel this command
and try again without it:

00:04:11.846 --> 00:04:17.026 align:middle
git commit -a -m "upgrade
to Symfony 8" There we go!

00:04:17.026 --> 00:04:20.896 align:middle
Now that we're on a clean slate,
check for recipe updates with:

00:04:20.896 --> 00:04:26.266 align:middle
symfony composer recipe:update
Nope, no new recipes!

00:04:26.706 --> 00:04:28.916 align:middle
Head back to the browser
and refresh the homepage.

00:04:30.586 --> 00:04:33.496 align:middle
Sweet! We're on Symfony 8 with no errors!

00:04:33.496 --> 00:04:38.066 align:middle
Since we upgraded ux-turbo, I'll just confirm
that it's working by clicking a link...

00:04:38.626 --> 00:04:41.416 align:middle
Turbo requests happen via AJAX, and sure enough,

00:04:41.416 --> 00:04:44.736 align:middle
our web debug toolbar shows
an AJAX request was made.

00:04:45.326 --> 00:04:48.996 align:middle
We also upgraded stimulus-bundle, so
let's check that it's working correctly.

00:04:49.576 --> 00:04:52.326 align:middle
Open the developer tools
and check the console tab...

00:04:52.926 --> 00:04:57.806 align:middle
These logs show that Stimulus and our Stimulus
controllers are being initialized correctly!

00:04:58.656 --> 00:04:59.486 align:middle
That's it folks!

00:04:59.626 --> 00:05:02.276 align:middle
I hope you learned something
valuable from this tutorial and manage

00:05:02.276 --> 00:05:04.936 align:middle
to upgrade your apps to Symfony 8 smoothly.

00:05:05.506 --> 00:05:07.076 align:middle
Til next time, Happy coding!

