Make self-healing URLs with Laravel

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

КОМЕНТАРІ • 148

  • @aarondfrancis
    @aarondfrancis  10 місяців тому +15

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

  • @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 26 днів тому

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

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

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

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

  • @ossamasid3591
    @ossamasid3591 10 місяців тому +15

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

  • @raphaeljaggerd3585
    @raphaeljaggerd3585 10 місяців тому +14

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

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

  • @guillermocava3568
    @guillermocava3568 10 місяців тому +3

    server rendered sites 1 - static stites 0

  • @pierredonias8940
    @pierredonias8940 9 місяців тому +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  9 місяців тому

      You could do that if you wanted using the same methods

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

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

  • @DioArsya
    @DioArsya 10 місяців тому +1

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

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

  • @vasiovasio
    @vasiovasio Місяць тому

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

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

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

  • @BlueeyesChineseguy
    @BlueeyesChineseguy 10 місяців тому +2

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

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

      mission accomplished then! 🫡

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

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

    What text editor are you using?

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

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

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

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

    Its new knowladge, and actually very usable

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

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

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

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

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

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

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

    Why is this needed 🤔

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

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

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

    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.

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

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

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

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

    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!

  • @MrNichuya
    @MrNichuya 10 місяців тому +1

    Big brain Aaron 👍

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

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

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

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

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

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

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

    wow it was 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

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

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

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

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

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

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

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

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

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

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

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

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

    Absolutely incredible videos from you this year! Thanks!

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

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

    why you don't just use id?

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

      For reasons explained in the video!

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

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

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

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

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

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

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

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

    You really good explaining

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

  • @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 :)

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

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

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

    Nice dive into Laravel model binding

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

    Thank you for this video.

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

    Hey

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

    Great video! Immediately used it!

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

    what a fun and useful idea! great job 👏

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

    veery awesome. loved it.

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

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

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

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

    Are you the same guy who makes videos at planetscale?

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

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

    Cooool

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

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

    How does this handle html anchors/#?

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

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

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

    Amazing

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

    this guy is awesome

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

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

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