Skip to content

Laravel Livewire Starter Kit

The Livewire starter kit (flowformhq/livewire-starter) is a Composer package that embeds FlowForm into a Laravel application using Livewire 3 and Blade templates — no JavaScript build step required.

Quick Start

bash
# In your Laravel project
composer require flowformhq/livewire-starter

# Publish config and views
php artisan vendor:publish --tag=flowform-starter-config
php artisan vendor:publish --tag=flowform-starter-views

# Configure environment
# Edit .env: set FLOWFORM_URL and FLOWFORM_TOKEN

Project Structure

src/
  Http/FlowFormClient.php          # Guzzle-based PHP SDK
  Livewire/FormRenderer.php        # Livewire 3 component
  LivewireStarterServiceProvider.php
resources/views/
  components/field-renderer.blade.php
  pages/form-renderer.blade.php
config/flowform-starter.php

Architecture

The kit follows the same server-authoritative rendering contract:

  1. Schema fetchGET /api/v1/forms/{uuid}/schema via Guzzle
  2. Submission creationPOST /api/v1/submissions
  3. Value upsertPOST /api/v1/submissions/{uuid}/values
  4. Step navigationadvance / retreat
  5. Condition refreshGET /api/v1/submissions/{uuid}/conditions
  6. SubmitPATCH /api/v1/submissions/{uuid}

Unlike the React and Vue kits, everything happens server-side via Livewire's wire protocol. The browser sends AJAX requests automatically when values change or buttons are clicked.

Key Differences from JS Kits

AspectLivewireReact / Vue
HTTP clientGuzzle (server-side)fetch (client-side)
StateLivewire public propertiesReact useState / Vue ref
RenderingBlade templatesJSX / Vue SFC
Two-way bindingwire:model.liveonChange / v-model
RoutingLaravel routesClient-side router
Build stepNoneVite build required
Error handlingInline $error propertyError boundary / error ref

Usage in a Blade View

blade
<div>
    <livewire:form-renderer :form-uuid="$formUuid" />
</div>

Customizing

Styling

All Blade views use Tailwind CSS classes. Override by publishing views:

bash
php artisan vendor:publish --tag=flowform-starter-views

Then edit resources/views/vendor/flowform-starter/ files.

Adding field types

Edit resources/views/vendor/flowform-starter/components/field-renderer.blade.php and add a new @elseif branch:

blade
@elseif($component === 'phone-input')
    <label for="{{ $field['code'] }}" class="block text-sm font-medium text-gray-700">
        {{ $field['label'] }}
    </label>
    <input type="tel" id="{{ $field['code'] }}" wire:model.live="values.{{ $field['code'] }}" class="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2" />

Config

Published to config/flowform-starter.php:

php
return [
    'url' => env('FLOWFORM_URL', 'http://localhost:8000'),
    'token' => env('FLOWFORM_TOKEN'),
];

Publishing

The package is published to Packagist as flowformhq/livewire-starter.

Licensed under CC BY 4.0.