arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Introduction

CBWIRE is a ColdBox module that makes building modern, reactive CFML apps a breeze without the need for JavaScript frameworks such as Vue or React, and without the hassle of creating unnecessary APIs.

Are you tired of the challenges that come with building modern CFML apps? ColdBoxarrow-up-right makes server-side app development a breeze, but sometimes the client-side is a whole different story. With powerful JavaScript frameworks like Vue and React, it can be a difficult and time-consuming process to create your web apps.

But what if you could have the best of both worlds: the power of Vue and React with the simplicity of CFML? Impossible, you say? Think again!

Introducing CBWIRE: Power up your CFML and make your app dreams a reality!

hashtag
Let's create a counter...

Install , then from our terminal, run:

Next, add wireStyles() and wireScripts() to our layout. This is required for CBWIRE to do it's magic.

Let's also insert a counter element into the page using wire( "Counter" ).

Let's define our counter .

Finally, let's create a for our counter Wire. Notice that we've added a wire:click to our button.

Refresh the page. You now have a reactive counter that increments when you click the plus button without any page refreshing!

hashtag
What!? How?

  1. CBWIRE renders our Counter Wire template. Our counter value defaults to 0.

  2. When a user clicks the plus button, CBWIRE detects the event and makes an XHR request to the server.

  3. CBWIRE picks up the XHR request and invokes the increment action.

hashtag
Awesome, right?

  • We built a reactive counter with no page refreshing.

  • We didn't write any JavaScript.

  • We didn't use webpack or mess with JavaScript compilation.

CBWIRE is transforming the way we build CFML applications, and we think you're going to love it also!

hashtag
Credits

CBWIRE is built on and wouldn't exist without ( creator of , ) and the PHP community.

The CBWIRE module for ColdBox is written and maintained by , , and .

hashtag
Project Support

Please consider becoming one of our lovingly esteemed .

hashtag
Resources

  • CBWIRE Examples:

  • ForgeBox:

  • GitHub Repository:

The increment method updates the counter state by 1.

  • CBWIRE re-renders the template and returns the updated HTML in the XHR response

  • CBWIRE detects any state changes and uses Livewire to mutate the DOM.

  • We never left CFML.🤓

    API Docs: https://apidocs.ortussolutions.com/#/coldbox-modules/cbwire/arrow-up-right

  • Issue Tracker: https://github.com/coldbox-modules/cbwire/issuesarrow-up-right

  • Task List Demo: https://github.com/grantcopley/cbwire-task-list-demoarrow-up-right

  • Form Validation Demo: https://github.com/grantcopley/cbwire-signup-form-demoarrow-up-right

  • Up and Running Screencast: https://cfcasts.com/series/ortus-single-video-series/videos/up-and-running-with-cbwirearrow-up-right

  • Into The Box 2021 Presentation: https://cfcasts.com/series/into-the-box-2021/videos/cbwire-coldbox-+-livewire-grant-copleyarrow-up-right

  • Ortus Webinar 2022: https://cfcasts.com/series/ortus-webinars-2022/videos/grant-copley-on-cbwire-+-alpine_jsarrow-up-right

  • CommandBoxarrow-up-right
    Wire
    Template
    directive
    Livewirearrow-up-right
    Caleb Porzioarrow-up-right
    Livewirearrow-up-right
    Alpine.jsarrow-up-right
    Grant Copleyarrow-up-right
    Luis Majanoarrow-up-right
    Ortus Solutionsarrow-up-right
    Patreon supportersarrow-up-right
    https://github.com/grantcopley/cbwire-examplesarrow-up-right
    https://forgebox.io/view/cbwirearrow-up-right
    https://github.com/coldbox-modules/cbwirearrow-up-right
    mkdir cbwire-demo
    cd cbwire-demo
    box coldbox create app
    box install cbwire@be
    box server start
    <!--- ./layouts/Main.cfm --->
    <cfoutput>
    <!doctype html>
    <html>
    <head>
        #wireStyles()#
    </head>
    <body>
        #wire( "Counter" )#
        #wireScripts()#
    </body>
    </html>
    </cfoutput>
    
    // ./wires/Counter.cfc
    component extends="cbwire.models.Component" {
    
        // Data Properties
        data = {
            "counter": 0
        };
    
        // Actions
        function increment(){
            data.counter += 1;
        }
    }
    
    <!--- ./views/wires/counter.cfm --->
    <cfoutput>
    <div>
        <div>Count: #args.counter#</div>
        <button wire:click="increment">
            +
        </button>
    </div>
    </cfoutput>