Make self-healing URLs with Laravel

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • КиноКино

Комментарии • 148

  • @aarondfrancis
    @aarondfrancis  10 месяцев назад +15

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

  • @ochronus
    @ochronus 10 месяцев назад +69

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +6

      That warms my heart. Thank you

  • @abdel17
    @abdel17 10 месяцев назад +105

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +16

      difficulty level: impossible

    • @JagdeepSinghKalsi
      @JagdeepSinghKalsi 10 месяцев назад +2

      Hold my beer....

    • @mbehboodian
      @mbehboodian 10 месяцев назад

      Agreed

    • @pookiepats
      @pookiepats 29 дней назад

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

  • @ossamasid3591
    @ossamasid3591 10 месяцев назад +15

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

  • @andyhinkle
    @andyhinkle 10 месяцев назад +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!

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +2

      Thanks Andy! I appreciate that

  • @raphaeljaggerd3585
    @raphaeljaggerd3585 10 месяцев назад +14

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

  • @vasiovasio
    @vasiovasio 2 месяца назад

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

  • @KieranHolroyd
    @KieranHolroyd 10 месяцев назад +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.

  • @pythonantole9892
    @pythonantole9892 10 месяцев назад

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

  • @DioArsya
    @DioArsya 10 месяцев назад +1

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

  • @ahmad-murery
    @ahmad-murery 10 месяцев назад +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  10 месяцев назад +12

      🥹 I'm thinking about it tbh

    • @ahmad-murery
      @ahmad-murery 10 месяцев назад

      @@aarondfrancis You're the one 👍🚀

    • @edwinshadian2852
      @edwinshadian2852 10 месяцев назад +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

  • @xinotsultan3867
    @xinotsultan3867 5 месяцев назад

    Its new knowladge, and actually very usable

  • @MattMcT
    @MattMcT 8 месяцев назад

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

  • @VadimBesedin
    @VadimBesedin 10 месяцев назад

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

  • @gregjfarias
    @gregjfarias 10 месяцев назад

    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 10 месяцев назад

    Nice dive into Laravel model binding

  • @MMDM95
    @MMDM95 10 месяцев назад

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

  • @dominuskelvin
    @dominuskelvin 10 месяцев назад

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

  • @pindab0ter
    @pindab0ter 10 месяцев назад +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!

  • @DPSGulag
    @DPSGulag 8 месяцев назад

    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!

  • @julienSibille
    @julienSibille 10 месяцев назад +1

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +1

      what a nice thing to say 🥹 thank you

  • @violin245
    @violin245 10 месяцев назад

    Absolutely incredible videos from you this year! Thanks!

  • @rsfllw
    @rsfllw 10 месяцев назад

    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

  • @tannercampbell
    @tannercampbell 10 месяцев назад

    what a fun and useful idea! great job 👏

  • @adampatterson
    @adampatterson 9 месяцев назад

    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.

  • @Exilum
    @Exilum 10 месяцев назад +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.

  • @danfg7215
    @danfg7215 10 месяцев назад +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.

  • @geHuC
    @geHuC 10 месяцев назад +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.

  • @MrNichuya
    @MrNichuya 10 месяцев назад +1

    Big brain Aaron 👍

  • @BlueeyesChineseguy
    @BlueeyesChineseguy 10 месяцев назад +2

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      mission accomplished then! 🫡

  • @kachelle
    @kachelle 10 месяцев назад

    Great video! Immediately used it!

  • @I_Lemaire
    @I_Lemaire 10 месяцев назад

    Thank you for this video.

  • @sheldon98c
    @sheldon98c 10 месяцев назад

    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 🚀

  • @EinLinuus
    @EinLinuus 10 месяцев назад

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

  • @rezanbs
    @rezanbs 5 месяцев назад

    wow it was awesome

  • @RealDyllon
    @RealDyllon 10 месяцев назад +1

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

  • @SeyedMansour27
    @SeyedMansour27 10 месяцев назад

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

  • @massadda5449
    @massadda5449 9 месяцев назад

    You really good explaining

  • @starcity254
    @starcity254 10 месяцев назад

    veery awesome. loved it.

  • @winchester2581
    @winchester2581 10 месяцев назад

    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

  • @estelsmith7175
    @estelsmith7175 10 месяцев назад +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  10 месяцев назад +1

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

  • @willi1978
    @willi1978 10 месяцев назад

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

  • @mohit84604
    @mohit84604 10 месяцев назад

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

  • @abdallakaram5376
    @abdallakaram5376 10 месяцев назад

    Amazing

  • @veds-art-world
    @veds-art-world 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      ULIDs are really really long, and ugly though!

  • @pierredonias8940
    @pierredonias8940 10 месяцев назад +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  10 месяцев назад

      You could do that if you wanted using the same methods

  • @Pang-nn4eq
    @Pang-nn4eq 10 месяцев назад

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

  • @soniablanche5672
    @soniablanche5672 10 месяцев назад

    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 10 месяцев назад

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

  • @vinayakdevc6
    @vinayakdevc6 10 месяцев назад

    this guy is awesome

  • @LinacchiUwU
    @LinacchiUwU 10 месяцев назад

    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

  • @borisjoffe
    @borisjoffe 6 месяцев назад +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.

  • @francismori7
    @francismori7 10 месяцев назад +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  10 месяцев назад +1

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

    • @francismori7
      @francismori7 10 месяцев назад

      ​@@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 10 месяцев назад

      @@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  10 месяцев назад

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

  • @Torbikini
    @Torbikini 10 месяцев назад

    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  10 месяцев назад +1

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

    • @Torbikini
      @Torbikini 10 месяцев назад

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

  • @MiklosGalicz
    @MiklosGalicz 9 месяцев назад

    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  9 месяцев назад

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

    • @MiklosGalicz
      @MiklosGalicz 9 месяцев назад

      @@aarondfrancis tbh, I like my uuids 😅

  • @francescoleto2823
    @francescoleto2823 10 месяцев назад

    Cooool

  • @guillermocava3568
    @guillermocava3568 10 месяцев назад +3

    server rendered sites 1 - static stites 0

  • @dhananjay7513
    @dhananjay7513 10 месяцев назад

    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?

  • @yunier91
    @yunier91 10 месяцев назад

    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.

  • @amiralam1786
    @amiralam1786 10 месяцев назад

    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?

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +2

      I cannot, because I'm not a node expert

  • @DaviMartins99
    @DaviMartins99 10 месяцев назад

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

  • @enzofalone
    @enzofalone 10 месяцев назад +1

    What text editor are you using?

  • @peanut3645
    @peanut3645 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +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.

  • @filipkalny6594
    @filipkalny6594 10 месяцев назад

    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  10 месяцев назад

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

  • @SeyedMansour27
    @SeyedMansour27 10 месяцев назад

    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 10 месяцев назад

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

  • @feldinho
    @feldinho 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      kinda dirty, but also... kinda awesome huh

    • @feldinho
      @feldinho 10 месяцев назад

      @@aarondfrancis I could get used to that :)

  • @1stKillZone
    @1stKillZone 10 месяцев назад

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

  • @DownloadableFox
    @DownloadableFox 10 месяцев назад

    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 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      Generally a descriptive url is a good seo signal!

  • @GuRuGeorge03
    @GuRuGeorge03 10 месяцев назад

    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  10 месяцев назад +1

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

  • @vikingthedude
    @vikingthedude 10 месяцев назад

    Are you the same guy who makes videos at planetscale?

  • @kyleridolfo
    @kyleridolfo 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +1

      🤐🤐🤐
      (My recording glasses have no lenses)

    • @kyleridolfo
      @kyleridolfo 10 месяцев назад

      ​@@aarondfrancis Incredible! The master.

    •  10 месяцев назад

      Polarizing filter, my friend.

  • @jvnko
    @jvnko 10 месяцев назад

    Ayo, what theme do you have in your ide?

    • @aarondfrancis
      @aarondfrancis  9 месяцев назад

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

  • @gagemonster555
    @gagemonster555 10 месяцев назад

    How does this handle html anchors/#?

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

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

  • @Bartek2OO219
    @Bartek2OO219 10 месяцев назад

    why you don't just use id?

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      For reasons explained in the video!

  • @bbbbburton
    @bbbbburton 10 месяцев назад

    Redirect should contain status code 301

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      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 10 месяцев назад +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 10 месяцев назад

    Why is this needed 🤔

  • @MichaelLazarski
    @MichaelLazarski 10 месяцев назад

    Whats that browser?

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +1

      Chrome!

    • @MichaelLazarski
      @MichaelLazarski 10 месяцев назад

      @@aarondfrancis do I miss some update ? haha mine does not look like that

  • @LOO_KING97
    @LOO_KING97 10 месяцев назад

    Hey

  • @ambuj.k
    @ambuj.k 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад +1

      In a good way right?

    • @ambuj.k
      @ambuj.k 10 месяцев назад

      @@aarondfrancis Exactly!

  • @herosova
    @herosova 10 месяцев назад

    I use codeignitor 4 will society accept me?

    • @alexmaven
      @alexmaven 10 месяцев назад

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

    • @aarondfrancis
      @aarondfrancis  10 месяцев назад

      😂

  • @instagramaccount6748
    @instagramaccount6748 9 месяцев назад

    How do with nextjs