https://htmx.org logo
Join Discord
Powered by
# php-htmx
  • t

    tall-dinner-62086

    05/09/2023, 2:16 PM
    Alternatively, put each of those in a separate file, then have your code call a file that looks like this:
    Copy code
    php
    <?php
    require 'logic.php';
    require 'view.php';
  • g

    great-cartoon-12331

    05/09/2023, 4:11 PM
    hmm, if the required form data is not received, why not respond with a 400 error? that way htmx would keep showing the old form and we could also get it to show an error message?
  • q

    quaint-truck-51155

    05/09/2023, 4:27 PM
    That was my thought too, thanks!
  • q

    quaint-truck-51155

    05/09/2023, 4:27 PM
    Thanks guys for the answers!
  • r

    ripe-agency-69289

    05/10/2023, 7:04 PM
    do { } while (false);
  • r

    ripe-agency-69289

    05/10/2023, 7:05 PM
    Replied to the wrong message but yes
  • r

    refined-waiter-90422

    05/10/2023, 7:15 PM
    I wish- can work, but comes with the gotcha of `break`only working on 1 level of loop at a time.
  • r

    refined-waiter-90422

    05/10/2023, 7:15 PM
    so if you
    for
    or
    foreach
    over anything in your input checks...
  • f

    freezing-waitress-26396

    05/11/2023, 12:44 AM
    I saw someone doing a foreach loop in a for loop or something and their attempt at breaking both was setting a bool then both loops did
    continue
    and
    continue 2
    if bool was true
  • s

    shy-zebra-22292

    05/11/2023, 4:17 AM
    Why are you messing with raw PHP? I am curious.
  • f

    freezing-waitress-26396

    05/11/2023, 6:42 AM
    Why not
  • q

    quaint-truck-51155

    05/11/2023, 7:30 AM
    I recently realised thats its a very capable language on its own and also just for fun 😀
  • q

    quaint-truck-51155

    05/11/2023, 7:32 AM
    But for my normal projects I use Python with Flask or Fastapi
  • r

    refined-waiter-90422

    05/11/2023, 7:41 AM
    fundamentally its just headers/body in, headers/body out. and vanilla php comes with pretty much everything, and is ultra-fast and reliable if you play into its strengths, ex: stick blocking work into a queue.
  • r

    refined-waiter-90422

    05/11/2023, 7:44 AM
    Having worked nearly 5 years in python now, to this day I still find it shocking how many ASGI frameworks (starlette, fastapi, etc) don't care about crash resiliency and anti-ddos the way PHP does, even though I'm of course a big fan of python. Same in node. I maintain a bunch of patches for uvicorn now (the FastAPI server) to add graceful worker reload, reload on worker crash, etc. That will likely never see mainline. Sanic at least does this stuff, though
  • f

    freezing-waitress-26396

    05/11/2023, 7:49 AM
    Plus, doing raw PHP is a great way to learn how it works by principle, you can achieve a lot of things with very little, I don't need to get a lot of dependencies using a framework to do simple things. And it natively plays in the hands of htmx, as PHP naturally outputs HTML.
  • r

    refined-waiter-90422

    05/11/2023, 8:02 AM
    Yup yup. The layer at which PHP sits at is really well targeted, reminds me of htmx a lot in this way.. just gives you the fundamental building blocks of the web.
  • r

    refined-waiter-90422

    05/11/2023, 8:07 AM
    I feel really bad for newcomers of web in general, the fundamentals are so obfuscated by marketing and hype now, the building blocks so squirreled away. A lot of new people keep asking me if they should go into front-end or back-end and I'm like.. bros, you should know both... but that can seem insane now even when the two are both so intertwined.
  • r

    refined-waiter-90422

    05/11/2023, 8:07 AM
    Leads to some really dubious decision making and cargo culting
  • r

    refined-waiter-90422

    05/11/2023, 8:09 AM
    when one hand has no idea what the other is doing
  • r

    refined-waiter-90422

    05/11/2023, 8:17 AM
    htmx shuts down the "you need react for SPA" trope which has been so damaging to the next generation of devs @mysterious-toddler-20573 🙏
  • s

    shy-zebra-22292

    05/11/2023, 4:48 PM
    I do not mean to scare you away but .. PHP is brutally good 😄 And I have had my share of trying Django and Rails...
  • q

    quaint-truck-51155

    05/11/2023, 5:12 PM
    I have some ideas for using it in the future 🙂 Also will try one of it's frameworks when I have the time
  • f

    freezing-waitress-26396

    05/19/2023, 4:09 PM
    Trying Laravel for the first time and I'm surprised how quickly I went to "I'm learning Laravel" to "I'm actually doing the things I want" I'm not used to be able to be productive that quickly
  • f

    freezing-waitress-26396

    05/19/2023, 4:09 PM
    htmx middleware for admin panel goes brrr
  • s

    shy-zebra-22292

    05/19/2023, 6:25 PM
    Cool! Enjoy!
  • s

    shy-zebra-22292

    05/19/2023, 6:45 PM
    check this out:https://laravel.com/docs/10.x/blade#rendering-blade-fragments
  • q

    quaint-truck-51155

    05/19/2023, 6:47 PM
    This is amazing. Go has the same thing, it makes your templates really clean
  • r

    refined-waiter-90422

    05/24/2023, 12:38 AM
    Not htmx but issue tracker in 1 file, under 500 lines: PHP + SQLite
  • s

    shy-zebra-22292

    05/24/2023, 5:02 AM
    It shows how good PHP is for writing web apps. It's a lot of functionality in 500 lines. On the other hand nobody would like to write code like that for a day job I suppose...