hash ID's aren't usually for security, it's use is primarily when you want an "unlisted" option, it also has good uses if you're using some kind of sharding, as it (some implementations) can use machine-specific information in the hash, it's not all random.
Wow -- This video left me in amazement, transitioning from moments of 'Huh... wow' to 'Whaaaat, I didn't know you could do that!' Incredible video Aaron! I didn't realize how much I needed it!
That's pretty cool, but why not put the slug at the front? That way someone copying a URL and missing the last letter or so would still get to the right page.
Very nice! It's just a shame that it's based on an ID. Reading the title, I was expecting some kind of error correction if there's a typo in the URL by comparing it to valid URLs, calculating distances, etc.
You're really good at explaining things. Your style is easy to follow along with, I wish I had some videos like this when I was starting out. Do you ever plan to do videos with Symfony, too?
I don't use Laravel, but this was a cool idea I might use in the future. I hadn't really thought about it as something I'd want, until I thought about people who favorite a page that could change names.
Great implementation Aaron! This is actually Mandatory for every modern site - robust SEO, so don't worry about changes made in the title, Bookmarks always work even if some changes are made! For a unique guarantee for the public IDs, instead of another package, we can use just a simple MD5 hash over the primary ID + some secret key ( just a string to add entropy ) and get the last 8-10 characters. As I commented on the last video, simply look at how long the video is and how almost no time is required for something so fundamental that you can award your effort to every user and request in the future! :)
This is cool exploration but I couldn't find a way how can this be beneficial luke having an expressive url is SEO friendly but how does self healing makes any difference in how someone search product, The only point I can think of is that they just have to type correct hash and they will be redirected to correct seo friendly domain but is this it?
@@aarondfrancis it will be really nice and not only for beginners. You have rare talent in explaining complicated things simply. And I see that you're really like it. A lot of new PHP developers will be grateful if you will make a Laravel course
Very, very cool video! Even though I might not use this specific example, the general approach of using the more advanced tools Laravel makes available is very inspiring!
Only thing I would change here Aaron is that you are hardcoding the route name in your redirect, so you will not be able to use your model binding on a different route
@@aarondfrancisyeah, but then, you may have issues with child routes... /posts/{post}/comments/{comment}. You will have to provide all attributes to properly generate the route. It's not as simple as I initially thought 🤔
@@francismori7 I guess we can replace the provided slug with our generated one in the request and redirect to replaced one though if you find a better solution please do share it.
Well, the security reason behind the hiding the incremental id is mostly because of the backend app devs not checking authorizations properly or your basic CRUD app doesn't offer the necessary access control features...
Nice, I did this years ago on a big 20,000 unit automotive site /year-make-model-trim-city/stock-number and totally forgot about the URL structure until now. I create a service that would generate the SEO slug and then ran a schedule task that cached the sitemaps and product feeds. Another tip SEP wise is to setup a canonical structure if you might have a lot of url variations, obviously a blog is different.
Great video! The concept struck me in awe so much I ended up playing with it first, then implementing it for my website. Had to take a completely different approach (using Request $request) due to how our codebase is now, but with the same principles and it worked magic. Found you out recently and I'm very pleased with the content so far!
this is the first of your videos which I've seen, and I'm primarily back end, but by company are just spinning up a 'look at me' product team I'm definintely going to send them this vid! +subbed
I have 2 questions: 1. whats the point of having this urls? the only thing i can think of is SEO because you can have several different urls with different names point to a single one each containing different tags? (is that even good?:) 2. if the url needs to heal you pass the model to the route 8:30 but you get it from db again? (line 22 happens again based of your explanations) can't we somehow skip this second db call?
if you want to use javascript style method on strings, you can use the laravel Str class helper use Illuminate\Support\Str; Str::of("some/string/I/want/to/split")->split("/\//")->last();
Отличное видео, очень нравится как ты говоришь. Возможно для презентации подошла бы светлая тема редактора, чтобы не мигало на видео. Не повлияет ли на CEO если Id будет в начале?
I might have to give Laravel a try now 👀 I am looking to make a new Vue project, so I’ll have to see how that would work with Laravel exactly, but this seems like a good backend choice.
eh I'm not so sure! 301s can be super permanent, and if the user changes their mind and updates the post title back to what it was originally, you might be hosed.
@@aarondfrancis Then I'd suggest a canonical tag be present on the page, with a version of the URL not containing the slug. If SEO is important, I'm trying to ensure search engines index a single version of the page. I'm also not sure about the 301. What does happen when a user changes a new title back to the original? I think the browser and search engines will resolve it okay. But I haven't done this stuff in years so please correct me if I'm wrong!
Luke Downing turned this into a very good, very robust package! github.com/lukeraymonddowning/self-healing-urls
Find someone who looks at you like Aaron looks at Laravel 🤣
difficulty level: impossible
Hold my beer....
Agreed
😂😂😂😂 i like this guy but it’s not that good compared to the hype here, very python-y in its picky prickly version hell
I wish I had content like yours 25 years ago when I was learning to code :)
That warms my heart. Thank you
hash ID's aren't usually for security, it's use is primarily when you want an "unlisted" option, it also has good uses if you're using some kind of sharding, as it (some implementations) can use machine-specific information in the hash, it's not all random.
Wow -- This video left me in amazement, transitioning from moments of 'Huh... wow' to 'Whaaaat, I didn't know you could do that!' Incredible video Aaron! I didn't realize how much I needed it!
Thanks Andy! I appreciate that
Even if you know the solution from the beginning, watching Aaron explains it, is priceless!
I'm not a big PHP fan but Laravel just makes it worth it.
kind of agree haha
I’m the exact same.
That's pretty cool, but why not put the slug at the front? That way someone copying a URL and missing the last letter or so would still get to the right page.
server rendered sites 1 - static stites 0
🎯
Very nice! It's just a shame that it's based on an ID. Reading the title, I was expecting some kind of error correction if there's a typo in the URL by comparing it to valid URLs, calculating distances, etc.
You could do that if you wanted using the same methods
You're really good at explaining things. Your style is easy to follow along with, I wish I had some videos like this when I was starting out.
Do you ever plan to do videos with Symfony, too?
Thank you so much! Probably not at this point, I'm mostly a Laravel user so I don't know much about Symfony
For those still living the apache life, you can always have a .htaccess rule with some regex that would behave the same way as amazons.
I found your videos mostly from Planetscale yt channel, the explanations are just *🤯💥”. Thank you & subscribed! haha
I don't use Laravel, but this was a cool idea I might use in the future. I hadn't really thought about it as something I'd want, until I thought about people who favorite a page that could change names.
Great implementation Aaron!
This is actually Mandatory for every modern site - robust SEO, so don't worry about changes made in the title, Bookmarks always work even if some changes are made!
For a unique guarantee for the public IDs, instead of another package, we can use just a simple MD5 hash over the primary ID + some secret key ( just a string to add entropy ) and get the last 8-10 characters.
As I commented on the last video, simply look at how long the video is and how almost no time is required for something so fundamental that you can award your effort to every user and request in the future! :)
I gotta be honest, this is pretty cool. I would've done it a lot uglier if I had to figure it out myself.
This is cool exploration but I couldn't find a way how can this be beneficial luke having an expressive url is SEO friendly but how does self healing makes any difference in how someone search product, The only point I can think of is that they just have to type correct hash and they will be redirected to correct seo friendly domain but is this it?
I dont know a thing about php or laravel but the concept is interesting!
mission accomplished then! 🫡
You're skill at explaining things is beyond what I've dealt with so far
One more time, please make a Laravel course.
Thanks Aaron!
🥹 I'm thinking about it tbh
@@aarondfrancis You're the one 👍🚀
@@aarondfrancis it will be really nice and not only for beginners. You have rare talent in explaining complicated things simply. And I see that you're really like it. A lot of new PHP developers will be grateful if you will make a Laravel course
What text editor are you using?
PHPStorm
Very, very cool video! Even though I might not use this specific example, the general approach of using the more advanced tools Laravel makes available is very inspiring!
Wow. First off you are a great teacher Aaron. Second, Laravel make this too easy.
Its new knowladge, and actually very usable
So the part of the url that's self-healing is the part that's actually entirely redundant? I was expecting some actual error-correction.
Sorry to disappoint! Hopefully you'll enjoy my next videos more
"Medium who even goes there anymore" quoted by a PHP developer in 2023
¯\_(ツ)_/¯
Great video on laravel! You should try making videos about databases too!
He does on @PlanetScale
This made me laugh
Only thing I would change here Aaron is that you are hardcoding the route name in your redirect, so you will not be able to use your model binding on a different route
Hmm that's a good point! I guess I should've inferred that from the current route
@@aarondfrancisyeah, but then, you may have issues with child routes... /posts/{post}/comments/{comment}. You will have to provide all attributes to properly generate the route. It's not as simple as I initially thought 🤔
@@francismori7 I guess we can replace the provided slug with our generated one in the request and redirect to replaced one though if you find a better solution please do share it.
@francismori7 @azzazkhansiddiqui here's a solution! github.com/lukeraymonddowning/self-healing-urls
Why is this needed 🤔
hashed ids are nice because u can authenticate them and give access to resources based on URI as a "password"
Well, the security reason behind the hiding the incremental id is mostly because of the backend app devs not checking authorizations properly or your basic CRUD app doesn't offer the necessary access control features...
Right, which is why I'm unmoved by that argument
@@aarondfrancis tbh, I like my uuids 😅
Nice, I did this years ago on a big 20,000 unit automotive site /year-make-model-trim-city/stock-number and totally forgot about the URL structure until now.
I create a service that would generate the SEO slug and then ran a schedule task that cached the sitemaps and product feeds.
Another tip SEP wise is to setup a canonical structure if you might have a lot of url variations, obviously a blog is different.
Is SEO the only reason to use self-healings URLs? I'm trying to understand when and why I would use self-healing URLs, thank you.
Oh my, there's so much to learn. I didn't even know self-healing urls were a thing.
Great video!
The concept struck me in awe so much I ended up playing with it first, then implementing it for my website.
Had to take a completely different approach (using Request $request) due to how our codebase is now, but with the same principles and it worked magic.
Found you out recently and I'm very pleased with the content so far!
Big brain Aaron 👍
Please do stuff, you do it so well !
Thank you for sharing knowledge !
what a nice thing to say 🥹 thank you
Wow! The idea is pretty amazing! The video made me think about .Net and how to implement it correctly (as I'm .Net dev). Laravel looks pretty cool tho
this is the first of your videos which I've seen, and I'm primarily back end, but by company are just spinning up a 'look at me' product team I'm definintely going to send them this vid!
+subbed
I have 2 questions:
1. whats the point of having this urls? the only thing i can think of is SEO because you can have several different urls with different names point to a single one each containing different tags? (is that even good?:)
2. if the url needs to heal you pass the model to the route 8:30 but you get it from db again? (line 22 happens again based of your explanations) can't we somehow skip this second db call?
Your content is freaking fantastic! Thank you so much for your energy and knowledge! ❤🎉😊
wow it was awesome
We use a old 1.12 version of Zend Framework at work which kinda made me hate php, but this does look pretty nice! Maybe I should give it a try someday
Thank you sir!. Can you teach us other more advance stuff of backend plz.
I've been working with Laravel for like 3 years, watching your material is like getting a fat-fast dose of knowledge. Amazing
I have implemented a feature similar to this in my app manually.
I was not aware of those inbuilt functions.
I need to read docs 🚀
What's the point of having the post title as a path in the url? Wouldn't it be simpler just to use the ID of the post? /gen
Like instead of:
.../posts/this-is-a-post-abc123
Just use
.../posts/abc123
Generally a descriptive url is a good seo signal!
This is awesome! Please make a Laravel course, that would be so cool 😄
interesting concept. i use neither laravel nor php but it can be implemented in other languages too
Awesome, I always get happy when you post a video. Thanks a lot🤩. Please post more often
Absolutely incredible videos from you this year! Thanks!
You can create public_id as ulid(provided by laravel) instead of string to generate unique string without any complications.
ULIDs are really really long, and ugly though!
why you don't just use id?
For reasons explained in the video!
What a nice and elegant solution. Thank you. And explanation style is great as well.
More Laravel Please! i would love to see efficiency and production advise!
Aaron we need you to reveal your biggest secret... how do we get our eyeglasses to not reflect light at the camera? 👓
🤐🤐🤐
(My recording glasses have no lenses)
@@aarondfrancis Incredible! The master.
Polarizing filter, my friend.
Ayo, what theme do you have in your ide?
It's a super old one called Heroku, by Dayle Rees
if you want to use javascript style method on strings, you can use the laravel Str class helper
use Illuminate\Support\Str;
Str::of("some/string/I/want/to/split")->split("/\//")->last();
Doing last(explode("/", "some/string/I/want/to/split")) feels a bit easier than chaining three methods.
Lol to even come up with this idea. I wonder if it was a customer who requested it or if a developer was just bored or somehow needed it
Haha who knows. Amazon is kinda famous for having URLs that are really reslient, even decades later
You really good explaining
your videos are AMAZING! but most of them are for laravel/php devs, can you also cover topics which could help node js backend devs too?
I cannot, because I'm not a node expert
As someone outside Laravel it's so weird having the model parsing route parameters by itself. I feel kinda dirty now.
kinda dirty, but also... kinda awesome huh
@@aarondfrancis I could get used to that :)
When are we getting Holly videos?!
Just kidding ofc, awesome content, Aaron!
Hahaha, soon
Nice dive into Laravel model binding
Thank you for this video.
Hey
Sup
Great video! Immediately used it!
what a fun and useful idea! great job 👏
veery awesome. loved it.
Be nice with Medium, there are many Laravel devs sharing posts there
haha, sorry 🤐
Отличное видео, очень нравится как ты говоришь. Возможно для презентации подошла бы светлая тема редактора, чтобы не мигало на видео. Не повлияет ли на CEO если Id будет в начале?
Good idea! I'll look into that. I the putting the ID at the end is more of an aesthetic thing, I'm not sure it would matter too much.
Are you the same guy who makes videos at planetscale?
It is me 🫡
I might have to give Laravel a try now 👀
I am looking to make a new Vue project, so I’ll have to see how that would work with Laravel exactly, but this seems like a good backend choice.
Totally! Laravel has a starter kit that's Laravel + Vue: laravel.com/docs/10.x/starter-kits#breeze-and-inertia
Thank you for sharing that! I’ll give it a look 👀
Cooool
As a Typescript developer, Laravel always seems like black magic to me.
In a good way right?
@@aarondfrancis Exactly!
How does this handle html anchors/#?
hmmm I don't know, but probably not very well tbh!
Amazing
this guy is awesome
🫡
Whats that browser?
Chrome!
@@aarondfrancis do I miss some update ? haha mine does not look like that
Redirect should contain status code 301
eh I'm not so sure! 301s can be super permanent, and if the user changes their mind and updates the post title back to what it was originally, you might be hosed.
@@aarondfrancis Then I'd suggest a canonical tag be present on the page, with a version of the URL not containing the slug.
If SEO is important, I'm trying to ensure search engines index a single version of the page.
I'm also not sure about the 301. What does happen when a user changes a new title back to the original? I think the browser and search engines will resolve it okay. But I haven't done this stuff in years so please correct me if I'm wrong!
I use codeignitor 4 will society accept me?
Society won’t but Aaron will…. If you learn Laravel. 😂
😂
How do with nextjs
I've never used it