PHPue Insights Hub

- A unified experience for web development! -

PHPue Logo - A modern PHP framework

PHPue Framework

Empowering dreams, pushing boundaries, and exploring limitless possibilities.

PHP Framework • Carmarthen, Wales.
📝

Latest Insights Posts

Fresh perspectives and updates

1
posts published
PHPue Framework Logo

PHPue Framework

• Author: Edward Patch

How is the PHPue Framework reshaping the open-source ecosystem?

How is PHPue Framework impacting the Open-Source community?

We discovered that AlpineJS and PHPue Framework works flawlessly, apart from that "x-for" attribute, which was far from what we needed. After some research, we found there was 3 issues, and 1 pull request with AlpineJS:

Issues:

  • 1.1: alpinejs/alpine#196
    • 1.2: Bind x-for items to server rendered items #196
  • 2.1: alpinejs/alpine#329
    • 2.2: x-for - how to use with pre-existing lists in html? #329
  • 3.1: alpinejs/alpine#450
    • 3.2: [Bug] x-for should generate valid/compliant html when used on elements such as lists, tables, selects etc #450

Pull Request:

The creator of PHPue Framework created a extension for AlpineJS, that introduces a x-ssr attribute! This is similar to x-for, though it respects what HTML blocks exist, then you define a "csrTemplate" variable when the array changes, which holds the building blocks for CSR controlled elements!
(This may feel like a sacrifice for DX, although, the choice derived from lack of performance, from how x-for was handled!)
Usage (The extension is still new, so any bugs, please create issues, and if you are down to contribute, fork and edit /assets/js/phpue-ext-csr/alpine.ext.prod.ssr.js, and minify the file
(I used https://www.minifier.org/):

<div x-data="customDataHandler"> 
   <ul x-ssr="varArrayName">
      <li p-for="$item in $items">{{ $item }}</li>
   </ul>
</div>

(OR)

(Managed by customDataHandler and csrTemplate! (just like x-for, but the definition is inside customDataHandler))

<ul x-data="customDataHandler" x-ssr="varArrayName">
</ul>

Who can use this extension?

  • PHPue Developers!
  • PHP Developers!
  • HTML + CSS + JS Developers!
  • Laravel Developers!
  • Other PHP Frameworks or SSR Frameworks that need AlpineJS!

Checkout PHPue's AlpineJS Extension by:
PHPue Extensions - AlpineJS SSR Extension

I have tested it, not thoroughly though! (There may still be some bugs or optimisations I may have missed over!) - From my personal testing, I have not seen any errors, or development strains.

Happy developing, Edward!

#opensource #alpine #alpinejs #phpueframework #development #php #js

👍 1 likes
0 shares

Latest Blog Posts

No Blog Posts Exist