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!
This tutorial works perfectly with both Symfony 7 & 8!
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
}
}
12 Comments
Hello,
Firstly great tutorial. ´Thank you very much.
I have a little Problem.
I always get a "500 Internal Server Error" when i put a "dd()" in my Controller files. I use Docker instead of Symfony binary. Also my PHP version is 8.4.14.
Do you have a slight supposition why this happens? I also asked various AI Models to help me out but all the solutions were wrong.
Hey Marcin,
Thanks for the kind words about this course! We're happy to hear you love it ❤️
About the problem, do you have a production 500 error? In dev mode you should see the exact stacktrace and more context about the exception and why it was thrown. If you jsut see the production 500 error - then it means you try to load your Symfony app in prod mode. And that makes sense that
dd()will not work in prod mode, that's available only in dev/test mode :)Just drop that
dd()so it could continue execution or switch your app into dev mode so you could see the actual dd's dump :)P.S. Also, you have any 500 errors and don't see much context what's going on - keep in mind you can check log files, e.g. var/log/prod.log in case you're loading the website in the prod mode - it will contain the context about what exactly went wrogn behind the scene :)
I hope that helps!
Cheers!
Hi Victor,
Altough my .env file the APP_ENV is set to dev i get the 500 error in my Browser. Also dump() does not work either.
Hey Marcin,
I mean, it's not clear if you have a dev or prod 500 error in the browser, if you could share a screenshot - that would help to understand it better. Though I may guess that's a prod error if you don't see much context.
In any way, you should definitely check your log files in var/log/ dir. You can try to remove them all there to start from scratch and refresh the page with the error, then you can check the var/log/ folder to see if there're any log files after that request. Check the appeared log file for more context about that's going on, there're a lot of possible problems.
But my guess is that somewhere in the Dockerfile you have
APP_ENVset toprod, could you double check it? Most probably it's in yourdocker-compose.yml. If you somehow set a real env var (or set it in the docker files) - then the env vars from .env files will be just ignored.Cheers!
Hello,
As you see below code, functions actually are same. I want to create only one fuction for these two route, index.html and topology_details.
I think I can use wildcard but I do no know how to restrict only for these two route. Is there any spesific way for this?
` #[Route('/index.html')]
`
Hey @Mahmut-A, I think something like this would work (please test):
--Kevin
Q:
What is the purpose of the createNotFoundException() method in Symfony controllers?
Correct answer here should be:
To create a new instance of the NotFoundException class
It creates 404 exception instance and returns it. Nothing else.
Thanks for reporting this @Krycha2341. I've updated the question and answer to be less ambiguous.
We can also type hint params and they will be validated
int $idHey @tomoguchi ,
Yeah, this way the
$idwill be typecasted tointeger:)Cheers!
Hello, love the tutorial, great teaching
Thanks!
"Houston: no signs of life"
Start the conversation!