[DEMO] Partial page rendering with stimulus.js

CakePHP with Stimulus.js

A demo showing Stimulus and CakePHP 3.x working together.
As example, it shows partial page rendering; replacing/adding server-side generated HTML snippets on the web page.

See it here

Deploy it yourself: Deploy

Why Stimulus

What Stimulus does can be done with other javascript libraries as well, but what I like is:

  • The HTML is not cluttered with script code or vague class names
  • It’s clear which controllers are used and where (data-controller attribute)
  • It’s clear where the controller will make changes (data-target attribute)
  • It’s clear what triggers the controller (data-action attribute)
  • The controllers have a life-cycle and are automatically connected and disconnected if the DOM-tree is modified.

Looks like an interesting thing :slight_smile:
I’ll be tinkering with it later down the road and maybe I can use it into my apps as well (not sure yet).

Thanks for sharing, also, welcome to the CakePHP community!

1 Like