HTMX in Laravel - AJAX calls with HTML

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

ความคิดเห็น • 27

  • @shofada
    @shofada ปีที่แล้ว +29

    HTMX feels natural. It is like this is how it should have been all along.

  • @naranyala_dev
    @naranyala_dev ปีที่แล้ว +14

    request: full series of Laravel + HTMX

  • @tanzimibthesam5861
    @tanzimibthesam5861 ปีที่แล้ว +13

    htmx with Alpine should be a gem combo alongside Laravel

    • @drehimself
      @drehimself  ปีที่แล้ว +4

      Yeah, seems like they would work well together.

  • @zaimcodes
    @zaimcodes 8 หลายเดือนก่อน

    Glad you clarified the main use case between both HTMX and Livewire cause I was getting the intuition it looks and works like Livewire... The concept is still the same but the implementations are both principally different

  • @hanymax
    @hanymax ปีที่แล้ว +3

    i love the way you explain things thanks for you great effort

  • @winter-survivor
    @winter-survivor ปีที่แล้ว +2

    Stuff starts to get really ugly/crazy at 14:29 LOL, but the overall solution is quite interesting.
    I would use it on small websites for sure.
    Thanks for share, Andre 👍

  • @cristianbilu
    @cristianbilu ปีที่แล้ว +1

    For the contact form example what i like to do is create a wrapper around the form that will contain your "#response" element and the form itself, i put hx-target="this" and hx-swap="outerHTML" on the wrapper and no target and swap on the form so it can bubble up to the wrapper, extract it into a partial or component and render the entire partial/component as the response. In this way you will always has a fresh form when you it is a success response and if i have errors i just flash the old input with session()->flashInput() so i can use the `old(VALUE, DEFAULT)` helper. Like you would do normally with blade and redirects

  • @Sandeep-jo6ve
    @Sandeep-jo6ve ปีที่แล้ว +5

    More content on laravel htmx alpine

  • @RezaOpdebeeck
    @RezaOpdebeeck 10 หลายเดือนก่อน

    great video, thanks! I like how you keep the errors in the editing.

  • @alikaram98
    @alikaram98 10 หลายเดือนก่อน

    Hi thank's for this video a have question
    I used htmx to delete and the deletion operation is done successfully, but the list is not updated. In your opinion, the reason is that file web.php is used instead of file api.php for routing?

  • @focusplanets4818
    @focusplanets4818 ปีที่แล้ว

    May i know why you refresh the page when you make changes in the response html file.

  • @dimatall
    @dimatall ปีที่แล้ว

    Hmtx is cool for ui stuff to show, hide, filter. For forms I would use livewire. Its just much simpler than writing everything on your own.

  • @alejandroulisessanchezgame6924
    @alejandroulisessanchezgame6924 ปีที่แล้ว

    How htmx can be use for a CRUD pure laravel or can olnly be use through api?

  • @nftsparatodos1274
    @nftsparatodos1274 ปีที่แล้ว

    Thanks for the excellent first approach to this new tool n_n

  • @MangukiyaVipul
    @MangukiyaVipul ปีที่แล้ว

    Thank you for sharing
    Please let me font and other extensions that you used in visual studio code
    Thanks

  • @hussainzayaan8184
    @hussainzayaan8184 ปีที่แล้ว

    What web server are you using? When I do the api call as shown in the first part, I get the response in 100ms give or take, but you got in 16ms, any idea why there is a huge perf gap?

    • @drehimself
      @drehimself  ปีที่แล้ว

      I'm using Valet locally. Not sure what could be causing your local server to be slow.

    • @prezes4478
      @prezes4478 8 หลายเดือนก่อน

      I know 5 months have passed since you asked this, but from your description i guess you are using Windows or WSL. From my experience, Laravel runs smoothly on Linux and Mac, while on Windows it usually gets kinda sloppy.

  • @KhantSiThuPhyo-c5c
    @KhantSiThuPhyo-c5c 9 หลายเดือนก่อน

    datatable need to update with htmx version

  • @LatenightDev
    @LatenightDev หลายเดือนก่อน

    Thankyou

  • @shubhamsahuSD
    @shubhamsahuSD ปีที่แล้ว

    Awesome...
    Can i edit ajax header too

    • @drehimself
      @drehimself  ปีที่แล้ว +1

      I'm not sure if you can change the headers... Here's more info on headers in the docs: htmx.org/docs/#request-headers

  • @syahnurnizam1755
    @syahnurnizam1755 ปีที่แล้ว +1

    Looks like this solution is much more complicated than using Laravel Livewire

  • @AndiKod
    @AndiKod 11 หลายเดือนก่อน

    The thing is that it's not "doing stuff in htmX" but in Laravel PHP, ...while recieving Ajax calls from a webpage (one way or another). It goes the same in the others demos using Python, Rust, Go or whatever.
    All the hype like "switch from React to Htmx" sounds like internet attention as you can't compare a JS framework that actually do everything with ajax calls that need a backend to actually do something.
    Htmx alone is like the Tailwind version of jQuery!

    • @LoudMouth_
      @LoudMouth_ 9 หลายเดือนก่อน +1

      Well yea, that's the point. YOU don't have to do anything (mostly) in the front-end with HTMX.
      Instead of passing JSON to the front end which requires an entire framework to unpack and render into HTML while managing a client version of state why not just send the HTML directly from the back end where the state is managed by the server?
      Even with react, you still need to process the data to send back from the server, the only difference is it's the HTML which can be inserted directly into the DOM.

  • @adonespitogonaif
    @adonespitogonaif ปีที่แล้ว

    Too much code duplication. And if you create partials/templates for each part of your view that will be messy too