PHP code example of myvars / form-flow

1. Go to this page and download the library: Download myvars/form-flow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

myvars / form-flow example snippets


#[Route('/task/new', name: 'app_demo_task_new', methods: ['GET', 'POST'])]
public function new(Request $request, CreateTaskMapper $mapper, CreateTaskHandler $handler, FormFlow $flow): Response
{
    return $flow->form(
        request: $request,
        formType: TaskType::class,
        data: new TaskForm(),
        mapper: $mapper,      // form DTO -> command
        handler: $handler,    // command -> ResultInterface
        context: FlowContext::forCreate(FlowModel::create('demo', 'task')),
    );
}

// config/bundles.php
return [
    // ...
    MyVars\FormFlow\FormFlowBundle::class => ['all' => true],
];