Make self-healing URLs with Laravel

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 148

  • @aarondfrancis
    @aarondfrancis  11 місяців тому +16

    Luke Downing turned this into a very good, very robust package! github.com/lukeraymonddowning/self-healing-urls

  • @ochronus
    @ochronus Рік тому +69

    I wish I had content like yours 25 years ago when I was learning to code :)

  • @abdel17
    @abdel17 Рік тому +105

    Find someone who looks at you like Aaron looks at Laravel 🤣

    • @aarondfrancis
      @aarondfrancis  Рік тому +16

      difficulty level: impossible

    • @JagdeepSinghKalsi
      @JagdeepSinghKalsi Рік тому +2

      Hold my beer....

    • @mbehboodian
      @mbehboodian 11 місяців тому

      Agreed

    • @pookiepats
      @pookiepats 2 місяці тому

      😂😂😂😂 i like this guy but it’s not that good compared to the hype here, very python-y in its picky prickly version hell

  • @andyhinkle
    @andyhinkle Рік тому +11

    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!

  • @ossamasid3591
    @ossamasid3591 Рік тому +15

    Even if you know the solution from the beginning, watching Aaron explains it, is priceless!

  • @DioArsya
    @DioArsya Рік тому +1

    I found your videos mostly from Planetscale yt channel, the explanations are just *🤯💥”. Thank you & subscribed! haha

  • @KieranHolroyd
    @KieranHolroyd Рік тому +28

    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.

  • @raphaeljaggerd3585
    @raphaeljaggerd3585 Рік тому +14

    I'm not a big PHP fan but Laravel just makes it worth it.

  • @vasiovasio
    @vasiovasio 3 місяці тому

    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! :)

  • @MattMcT
    @MattMcT 9 місяців тому

    Your content is freaking fantastic! Thank you so much for your energy and knowledge! ❤🎉😊

  • @pythonantole9892
    @pythonantole9892 11 місяців тому

    Oh my, there's so much to learn. I didn't even know self-healing urls were a thing.

  • @VadimBesedin
    @VadimBesedin 11 місяців тому

    What a nice and elegant solution. Thank you. And explanation style is great as well.

  • @ahmad-murery
    @ahmad-murery Рік тому +13

    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!

    • @aarondfrancis
      @aarondfrancis  Рік тому +12

      🥹 I'm thinking about it tbh

    • @ahmad-murery
      @ahmad-murery Рік тому

      @@aarondfrancis You're the one 👍🚀

    • @edwinshadian2852
      @edwinshadian2852 Рік тому +1

      @@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

  • @MMDM95
    @MMDM95 Рік тому

    Awesome, I always get happy when you post a video. Thanks a lot🤩. Please post more often

  • @DPSGulag
    @DPSGulag 9 місяців тому

    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!

  • @gregjfarias
    @gregjfarias Рік тому

    I've been working with Laravel for like 3 years, watching your material is like getting a fat-fast dose of knowledge. Amazing

  • @mityukov
    @mityukov Рік тому

    Nice dive into Laravel model binding

  • @dominuskelvin
    @dominuskelvin 11 місяців тому

    Wow. First off you are a great teacher Aaron. Second, Laravel make this too easy.

  • @rsfllw
    @rsfllw Рік тому

    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

  • @pindab0ter
    @pindab0ter Рік тому +1

    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!

  • @violin245
    @violin245 Рік тому

    Absolutely incredible videos from you this year! Thanks!

  • @julienSibille
    @julienSibille Рік тому +1

    Please do stuff, you do it so well !
    Thank you for sharing knowledge !

  • @adampatterson
    @adampatterson 10 місяців тому

    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.

  • @tannercampbell
    @tannercampbell Рік тому

    what a fun and useful idea! great job 👏

  • @EinLinuus
    @EinLinuus 11 місяців тому

    This is awesome! Please make a Laravel course, that would be so cool 😄

  • @Exilum
    @Exilum Рік тому +2

    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.

  • @SeyedMansour27
    @SeyedMansour27 Рік тому

    More Laravel Please! i would love to see efficiency and production advise!

  • @RealDyllon
    @RealDyllon 11 місяців тому +1

    Great video on laravel! You should try making videos about databases too!

  • @geHuC
    @geHuC Рік тому +2

    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.

  • @kachelle
    @kachelle Рік тому

    Great video! Immediately used it!

  • @massadda5449
    @massadda5449 11 місяців тому

    You really good explaining

  • @I_Lemaire
    @I_Lemaire Рік тому

    Thank you for this video.

  • @sheldon98c
    @sheldon98c Рік тому

    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 🚀

  • @xinotsultan3867
    @xinotsultan3867 6 місяців тому

    Its new knowladge, and actually very usable

  • @MrNichuya
    @MrNichuya Рік тому +1

    Big brain Aaron 👍

  • @danfg7215
    @danfg7215 Рік тому +1

    I gotta be honest, this is pretty cool. I would've done it a lot uglier if I had to figure it out myself.

  • @BlueeyesChineseguy
    @BlueeyesChineseguy Рік тому +2

    I dont know a thing about php or laravel but the concept is interesting!

  • @starcity254
    @starcity254 Рік тому

    veery awesome. loved it.

  • @estelsmith7175
    @estelsmith7175 Рік тому +4

    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?

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Thank you so much! Probably not at this point, I'm mostly a Laravel user so I don't know much about Symfony

  • @winchester2581
    @winchester2581 Рік тому

    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

  • @borisjoffe
    @borisjoffe 8 місяців тому +1

    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.

  • @rezanbs
    @rezanbs 6 місяців тому

    wow it was awesome

  • @soniablanche5672
    @soniablanche5672 Рік тому

    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();

    • @azzazkhansiddiqui
      @azzazkhansiddiqui 11 місяців тому

      Doing last(explode("/", "some/string/I/want/to/split")) feels a bit easier than chaining three methods.

  • @mohit84604
    @mohit84604 Рік тому

    Thank you sir!. Can you teach us other more advance stuff of backend plz.

  • @veds-art-world
    @veds-art-world Рік тому

    You can create public_id as ulid(provided by laravel) instead of string to generate unique string without any complications.

    • @aarondfrancis
      @aarondfrancis  Рік тому

      ULIDs are really really long, and ugly though!

  • @pierredonias8940
    @pierredonias8940 11 місяців тому +1

    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.

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      You could do that if you wanted using the same methods

  • @francismori7
    @francismori7 11 місяців тому +2

    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

    • @aarondfrancis
      @aarondfrancis  11 місяців тому +1

      Hmm that's a good point! I guess I should've inferred that from the current route

    • @francismori7
      @francismori7 11 місяців тому

      ​@@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 🤔

    • @azzazkhansiddiqui
      @azzazkhansiddiqui 11 місяців тому

      @@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.

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      @francismori7 @azzazkhansiddiqui here's a solution! github.com/lukeraymonddowning/self-healing-urls

  • @Torbikini
    @Torbikini Рік тому

    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.

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Totally! Laravel has a starter kit that's Laravel + Vue: laravel.com/docs/10.x/starter-kits#breeze-and-inertia

    • @Torbikini
      @Torbikini Рік тому

      Thank you for sharing that! I’ll give it a look 👀

  • @willi1978
    @willi1978 Рік тому

    interesting concept. i use neither laravel nor php but it can be implemented in other languages too

  • @LinacchiUwU
    @LinacchiUwU 11 місяців тому

    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

  • @Pang-nn4eq
    @Pang-nn4eq Рік тому

    hashed ids are nice because u can authenticate them and give access to resources based on URI as a "password"

  • @abdallakaram5376
    @abdallakaram5376 Рік тому

    Amazing

  • @yunier91
    @yunier91 11 місяців тому

    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.

  • @MiklosGalicz
    @MiklosGalicz 11 місяців тому

    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...

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      Right, which is why I'm unmoved by that argument

    • @MiklosGalicz
      @MiklosGalicz 11 місяців тому

      @@aarondfrancis tbh, I like my uuids 😅

  • @vinayakdevc6
    @vinayakdevc6 Рік тому

    this guy is awesome

  • @DaviMartins99
    @DaviMartins99 Рік тому

    When are we getting Holly videos?!
    Just kidding ofc, awesome content, Aaron!

  • @dhananjay7513
    @dhananjay7513 11 місяців тому

    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?

  • @peanut3645
    @peanut3645 Рік тому

    Отличное видео, очень нравится как ты говоришь. Возможно для презентации подошла бы светлая тема редактора, чтобы не мигало на видео. Не повлияет ли на CEO если Id будет в начале?

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      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.

  • @amiralam1786
    @amiralam1786 Рік тому

    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?

  • @SeyedMansour27
    @SeyedMansour27 Рік тому

    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?

  • @mikeeomega
    @mikeeomega Рік тому

    Be nice with Medium, there are many Laravel devs sharing posts there

  • @enzofalone
    @enzofalone 11 місяців тому +1

    What text editor are you using?

  • @francescoleto2823
    @francescoleto2823 Рік тому

    Cooool

  • @guillermocava3568
    @guillermocava3568 Рік тому +3

    server rendered sites 1 - static stites 0

  • @gagemonster555
    @gagemonster555 Рік тому

    How does this handle html anchors/#?

    • @aarondfrancis
      @aarondfrancis  Рік тому

      hmmm I don't know, but probably not very well tbh!

  • @filipkalny6594
    @filipkalny6594 11 місяців тому

    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.

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      Sorry to disappoint! Hopefully you'll enjoy my next videos more

  • @feldinho
    @feldinho Рік тому

    As someone outside Laravel it's so weird having the model parsing route parameters by itself. I feel kinda dirty now.

    • @aarondfrancis
      @aarondfrancis  Рік тому

      kinda dirty, but also... kinda awesome huh

    • @feldinho
      @feldinho Рік тому

      @@aarondfrancis I could get used to that :)

  • @vikingthedude
    @vikingthedude Рік тому

    Are you the same guy who makes videos at planetscale?

  • @1stKillZone
    @1stKillZone 11 місяців тому

    "Medium who even goes there anymore" quoted by a PHP developer in 2023

  • @DownloadableFox
    @DownloadableFox 11 місяців тому

    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

    • @DownloadableFox
      @DownloadableFox 11 місяців тому

      Like instead of:
      .../posts/this-is-a-post-abc123
      Just use
      .../posts/abc123

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      Generally a descriptive url is a good seo signal!

  • @jvnko
    @jvnko 11 місяців тому

    Ayo, what theme do you have in your ide?

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      It's a super old one called Heroku, by Dayle Rees

  • @GuRuGeorge03
    @GuRuGeorge03 Рік тому

    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

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Haha who knows. Amazon is kinda famous for having URLs that are really reslient, even decades later

  • @kyleridolfo
    @kyleridolfo 11 місяців тому

    Aaron we need you to reveal your biggest secret... how do we get our eyeglasses to not reflect light at the camera? 👓

    • @aarondfrancis
      @aarondfrancis  11 місяців тому +1

      🤐🤐🤐
      (My recording glasses have no lenses)

    • @kyleridolfo
      @kyleridolfo 11 місяців тому

      ​@@aarondfrancis Incredible! The master.

    •  11 місяців тому

      Polarizing filter, my friend.

  • @MichaelLazarski
    @MichaelLazarski Рік тому

    Whats that browser?

  • @Bartek2OO219
    @Bartek2OO219 11 місяців тому

    why you don't just use id?

    • @aarondfrancis
      @aarondfrancis  11 місяців тому

      For reasons explained in the video!

  • @bbbbburton
    @bbbbburton Рік тому

    Redirect should contain status code 301

    • @aarondfrancis
      @aarondfrancis  Рік тому

      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.

    • @bbbbburton
      @bbbbburton Рік тому +1

      @@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!

  • @HSBTechYT
    @HSBTechYT 11 місяців тому

    Why is this needed 🤔

  • @ambuj.k
    @ambuj.k 11 місяців тому

    As a Typescript developer, Laravel always seems like black magic to me.

    • @aarondfrancis
      @aarondfrancis  11 місяців тому +1

      In a good way right?

    • @ambuj.k
      @ambuj.k 11 місяців тому

      @@aarondfrancis Exactly!

  • @LOO_KING97
    @LOO_KING97 11 місяців тому

    Hey

  • @herosova
    @herosova Рік тому

    I use codeignitor 4 will society accept me?

    • @alexmaven
      @alexmaven Рік тому

      Society won’t but Aaron will…. If you learn Laravel. 😂

    • @aarondfrancis
      @aarondfrancis  Рік тому

      😂