3neti / form-flow
Driver-based form flow orchestration system with DirXML-style mapping for Laravel applications
Requires
- php: ^8.2
- illuminate/support: ^11.0 || ^12.0 || ^13.0
- spatie/laravel-data: ^4.0
- symfony/yaml: ^7.4
Requires (Dev)
- inertiajs/inertia-laravel: ^2.0 || ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0 || ^10.3 || ^11.0
- pestphp/pest: ^3.8 || ^4.0
- pestphp/pest-plugin-laravel: ^3.2 || ^4.0
This package is auto-updated.
Last update: 2026-08-11 01:14:42 UTC
README
Driver-based form flow orchestration system with DirXML-style mapping for Laravel applications.
Features
- Driver-Based Architecture: Define multi-step form flows using YAML configuration files
- DirXML-Style Mapping: Transform and map data between steps using flexible mapping rules
- Handler Plugin System: Extend functionality with custom form handlers
- Built-in Handlers: FormHandler, SplashHandler, and MissingHandler included
- Vue Components: Pre-built Inertia.js Vue components for rapid development
- Configurable: Customize route prefixes, middleware, and behavior
- Self-Contained: Automatic CSRF handling, route registration, and asset publishing
Requirements
- PHP ^8.2
- Laravel ^11.0 || ^12.0 || ^13.0
- Inertia.js ^2.0 || ^3.0
Installation
Install via Composer:
composer require 3neti/form-flow:^1.8
Publish Assets
Publish the configuration file:
php artisan vendor:publish --tag=form-flow-config
Publish driver examples:
php artisan vendor:publish --tag=form-flow-drivers
Publish Vue components:
php artisan vendor:publish --tag=form-flow-views
Or publish everything at once:
php artisan vendor:publish --tag=form-flow-core
Configuration
The package configuration is located at config/form-flow.php:
return [ 'route_prefix' => env('FORM_FLOW_ROUTE_PREFIX', 'form-flow'), 'middleware' => ['web'], 'driver_directory' => config_path('form-flow-drivers'), 'session_prefix' => 'form_flow', 'handlers' => [ // Plugin handlers register themselves via service providers ], ];
Usage
Creating a Form Flow
Define a flow driver in config/form-flow-drivers/my-flow.yaml:
name: my-flow title: My Form Flow steps: - handler: splash config: title: Welcome message: Let's get started - handler: form config: title: User Information fields: - name: full_name type: text label: Full Name validation: required|string|max:255
Starting a Flow
use Illuminate\Support\Facades\Http; $response = Http::post('/form-flow/start', [ 'reference_id' => 'unique-transaction-id', 'steps' => [ ['handler' => 'splash', 'config' => [...]], ['handler' => 'form', 'config' => [...]], ], 'callbacks' => [ 'on_complete' => 'https://your-app.com/api/flow-complete', 'on_cancel' => 'https://your-app.com/api/flow-cancelled', ], ]); $flowUrl = $response->json('flow_url');
Available Routes
The package automatically registers these routes:
POST /form-flow/start- Start a new flowGET /form-flow/{flow_id}- Show current stepPOST /form-flow/{flow_id}/step/{step}- Update step dataPOST /form-flow/{flow_id}/complete- Complete flowPOST /form-flow/{flow_id}/cancel- Cancel flowDELETE /form-flow/{flow_id}- Destroy flow state
Plugin Development
Create custom handlers by implementing FormHandlerInterface:
use LBHurtado\FormFlowManager\Contracts\FormHandlerInterface; class MyCustomHandler implements FormHandlerInterface { public function getName(): string { return 'my-custom'; } public function handle(Request $request, FormFlowStepData $step, array $context = []): array { // Process step data return ['processed' => true]; } public function render(FormFlowStepData $step, array $context = []) { return inertia('MyCustomView', [...]); } // ... other methods }
Register in your service provider:
public function boot(): void { $handlers = config('form-flow.handlers', []); $handlers['my-custom'] = MyCustomHandler::class; config(['form-flow.handlers' => $handlers]); }
Vue Components
The package includes ready-to-use Vue components:
GenericForm.vue- Generic form rendererSplash.vue- Splash screen handlerComplete.vue- Flow completion pageMissingHandler.vue- Fallback for missing handlers
Testing
The current release matrix covers PHP 8.3 and 8.4 on Laravel 12 and 13. Laravel 11 remains supported by the package constraints.
composer test
Changelog
Please see CHANGELOG for recent changes.
License
The MIT License (MIT). Please see License File for more information.