Chapters
21 Chapters
|
2:23:48
|
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.1",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/asset": "6.0.*", // v6.0.3
"symfony/console": "6.0.*", // v6.0.3
"symfony/dotenv": "6.0.*", // v6.0.3
"symfony/flex": "^2", // v2.4.5
"symfony/framework-bundle": "6.0.*", // v6.0.4
"symfony/monolog-bundle": "^3.0", // v3.7.1
"symfony/runtime": "6.4.3", // v6.4.3
"symfony/twig-bundle": "6.0.*", // v6.0.3
"symfony/ux-turbo": "^2.0", // v2.0.1
"symfony/webpack-encore-bundle": "^1.13", // v1.13.2
"symfony/yaml": "6.0.*", // v6.0.3
"twig/extra-bundle": "^2.12|^3.0", // v3.3.8
"twig/twig": "^2.12|^3.0" // v3.3.8
},
"require-dev": {
"symfony/debug-bundle": "6.0.*", // v6.0.3
"symfony/stopwatch": "6.0.*", // v6.0.3
"symfony/web-profiler-bundle": "6.0.*" // v6.0.3
}
}
22 Comments
I have to add: use function Symfony\Component\String\u; to make it work. VSCodium does not show autocomplete, but here is well explained too https://symfony.com/doc/cur...
Alternatively, instead of
u($text), you can also use(new UnicodeString($text)).If anyone else encounters this problem in PhpStorm: You have to hit TAB after typing "u" to autocomplete and autoimport the necessary function.
Hey boban_dj
The fuction import is not shown in the video but if you look on the code blocks from the script, you'll see Ryan used exactly that function. Good job finding it out.
Cheers!
So what's cool: if we're using the
u()function anyway, we can letu()run the replace function too!Hey @codemaestro ,
Good catch! Really, that can be completely done with
u()methods now :) Thanks for sharing this with others!Cheers!
i really want to say i appreciate these videos ...for someone who is new on symfony your way of doing things makes super sense
Hello,
In below codes, my environment does not accept u method so I used
ucwordsmethod. Addition to this, I did not use->title(True);at the end of that statement.still it is working.
is it must to use use
->title(true);method?thank you
Hey Mahmut,
The
->title()method is a method on an object that returns thatu()function. But to be able to use it - you need to install it first. See official docs about that String component for more clue: https://symfony.com/doc/current/components/string.htmlI hope that helps!
Cheers!
Hey @Mazzucato ,
Both ways work actually. If you would read the last sentence in that explanation:
we mean that you don't have to give every wildcard a corresponding argument in the method signature. You can skip that
$highlightat all as in our example. E.g. it may just exist there but you don't need it in the method's code, i.e. don't use it there. That's what we meant there :)Cheers!
i really want to say i appreciate these videos ...for someone who is new on symfony your way of doing things makes super sense sure
I'm glad to know you like our videos. Cheers!
Good one
Hi!
My application has to manage multiple domains. When I'm using the 'host' route parameter, it matches differently if user entered 'www' or not in the browser: www.example.com and example.com are not considered as the same host. How can I add a wildcard that could solve that?
Thanks!
Hey Sebastien D.
I think a better solution would be to add a redirect at the web server level, for example all requests coming from www.example.com should redirect to example.com, or viceversa.
Cheers!
Hi, I am working on Ubuntu 20.04 and installed apache2,php, mysql and composer. On symfony 6 , #[Route('/browse')] doesn't work. I have 404 page "The requested URL was not found on this server." I have installed "symfony/apache-pack". I still have the same result.
`#[Route('/browse')]
Best regards
Hey Eskinder,
First of all, please, make sure the route is exist in the system - for this, run:
$ bin/console debug:router | grep browse
Do you see the route in the output? is it just "/browse" or does it has a prefix? Also, make sure this route is registered for GET (or any) requests. If so, then most probably the problem in your Apache config. First of all, make sure you set the public/ directory as your document root. Then, double-check the other config. Actually, Symfony gives the correct Apache/Nginx configs in the docs, see: https://symfony.com/doc/cur... - there's important to know if you configure it via PHP-FPM or in a different way - there are different configs. But basically, if the route exist and you configured the host well using the config from the docs - it should work. Also, don't forget to restart your Apache server after tweaking any config - that's important, most users forget to do this :)
I hope this helps!
Cheers!
Hi,
I have a strange question, I hope you will understand me.
In your example, "/browse" is hard coded.
Is it possible to save "/ browse" in the database and call from there.
Problem is if user wants to change "/browse" to "/somethig-else" he can't do that from cms it must be changed in code.
Best regards
Yes, that is why you have the
{wildcard}route. So all you need to do is change the/browseroute to/{browse}now it matches anything you pass to it and you can check if that route or slug exists in your databaseSo /{browse} cen be value from data base?
"Houston: no signs of life"
Start the conversation!