Chapters
20 Chapters
|
1:53:05
|
Login to bookmark this video
-
Course Code
Login or register to download the code!
Login or register to download the code!
-
This Video
Login or register to download the video!
Login or register to download the video!
-
Subtitles
Login or register to download the subtitles!
Login or register to download the subtitles!
-
Course Script
Login or register to download the script!
Login or register to download the script!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"php-cs-fixer/shim": "^3.46", // v3.46.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.25", // 1.25.0
"symfony/asset": "7.0.*", // v7.0.3
"symfony/asset-mapper": "7.0.*", // v7.0.2
"symfony/console": "7.0.*", // v7.0.2
"symfony/dotenv": "7.0.*", // v7.0.2
"symfony/flex": "^2", // v2.4.3
"symfony/framework-bundle": "7.0.*", // v7.0.2
"symfony/monolog-bundle": "^3.0", // v3.10.0
"symfony/property-access": "7.0.*", // v7.0.0
"symfony/property-info": "7.0.*", // v7.0.0
"symfony/runtime": "7.0.*", // v7.0.0
"symfony/serializer": "7.0.*", // v7.0.2
"symfony/stimulus-bundle": "^2.13", // v2.13.3
"symfony/twig-bundle": "7.0.*", // v7.0.0
"symfony/ux-turbo": "^2.13", // v2.13.2
"symfony/yaml": "7.0.*", // v7.0.0
"symfonycasts/tailwind-bundle": "^0.7.1", // v0.7.1
"twig/extra-bundle": "^2.12|^3.0", // v3.8.0
"twig/twig": "^2.12|^3.0" // v3.8.0
},
"require-dev": {
"symfony/debug-bundle": "7.0.*", // v7.0.0
"symfony/maker-bundle": "^1.52", // v1.53.0
"symfony/stopwatch": "7.0.*", // v7.0.0
"symfony/web-profiler-bundle": "7.0.*" // v7.0.2
}
}
10 Comments
at the 2nd minute and 9 seconds: you show a cheatcode for your code editor. For other viewers, if you dont see the two options with the yellow lightbulb in phpstorm, try this: File -> Settings -> PHP -> Symfony -> Enable plugin.
it was disabled in my editor and enabling it did the trick! :)
Hey Linda,
Thanks for this tip! :)
Cheers!
What if I wanted to add a 'former command'* listing that referenced one of the other ships? How would I modify StarshipController to allow that? Do I just write another find with the other ship id as the variable?
Hey @skribe!
Yep, you're on the right track. For the app in its current state, you'd need to add the former ship id to the model, then use the repository to grab it in your controller.
Once the database/Doctrine is setup, this will be much easier. This is a perfect example of a Doctrine relationship and that's the next course to come out in this track! Keep an eye out for that - it should be dropping in the next few weeks.
--Kevin
Hi!
Using the same regex
<\d+>twice in 2 different places (StarshipControllerandStarshipApiController) is code duplication, does Symfony allow to reuse regex in the#[Route ...]attribute with an existing functional, like a service?Thanks!
Hey @randomsymbols!
Good point. The Routing component includes a Requirement enum that includes common regexes (
Requirement::DIGITScould be used here). Check out this example to see how it works. I like using this as it makes your routes easier to read/understand.You can also add your own constants (or backed enums) for commonly used patterns in your application.
I personally prefer using the
requirementsattribute argument vs embedding the regex in the path (again, to ease readability).Hope that helps!
Kevin
Hi, at the 2nd minute and 9 seconds: https://symfonycasts.com/screencast/symfony/generate-urls?playAt=127 - you show a cheatcode for your code editor, is there an extension or similar for VSCODE? THANKS :)
Hey Vince,
I see you're referring to creating a template feature from the Symfony plugin. Unfortunately, I don't use VSCode so can't say you for sure, but as I see over the internet there's no something similar there. You just need to create that file manually. What I see is that you can create a "custom snippet" in VS Code that makes it easier to generate basic Twig templates. This won't automatically generate the file, but it can streamline repetitive tasks for you I suppose.
I hope this helps!
Cheers!
Thanks for your response :)
I found the same information on the Internet but the task is not automatic, you must to enter the path, name, ext... well.. create the file is most quick. ^^
Hey Vince,
Yeah, it would be great to have better integration. But so far, Symfony plugin just creates an empty template, so empty file creating should not be much longer :) Otherwise, consider switching to PhpStorm ;)
Cheers!
"Houston: no signs of life"
Start the conversation!