Introduction
cbwire is a ColdBox module that makes building reactive, modern apps easy without leaving the comfort of CFML.
Last updated
cbwire is a ColdBox module that makes building reactive, modern apps easy without leaving the comfort of CFML.
Last updated
Building modern apps is complicated. ColdBox makes creating server-side CFML apps easy, but what about the client-side? Front-end JavaScript frameworks like Vue and React are powerful, yet they also introduce complexity and a significant learning curve when creating our apps.
What if you could create apps that look and feel like your Vue and React web apps... but are written with CFML? Impossible, you say? Nay, we say!
Introducing **cbwire: Power-up your CFML!
Install CommandBox, then from your terminal, run:
Let's add cbwire styling and script references to our layout using wireStyles()
and wireScripts()
, and include a cbwire component we will create using wire( "Counter ")
.
Let's create our Counter cbwire component.
Now that you've created your Counter component, you can include this component in any layout or view throughout your ColdBox app using the wire()
helper method.
Refresh the page and you find a reactive counter that increments when you hit the plus button.
cbwire renders our Counter component with our .cfm
page. ( View Source to see this ). This means cbwire is SEO-friendly.
When a user clicks the plus button, cbwire makes an AJAX request to the server and triggers the increment action.
cbwire updates the counter state
cbwire re-renders the component template and returns the updated HTML in the AJAX response
cbwire is using the amazing Livewire JavaScript library to mutate the DOM based on our state changes.
We built a reactive counter.
The counter updates without any page refresh.
We didn't write any JavaScript.
We didn't mess with webpack or JavaScript compilation.
We're just getting warmed up! cbwire is transforming the way we build CFML applications, and we think you're going to love it also.
cbwire is built on Livewire and wouldn't exist if it wasn't for the efforts of Caleb Porzio ( creator of Livewire, Alpine.js ) and the PHP community.
The cbwire module for ColdBox is written and maintained by Grant Copley, Luis Majano, and Ortus Solutions.
Please consider becoming one of our lovingly esteemed Patreon supporters.
We never left CFML.