PHP code example of depa / middleware-formularhandler

1. Go to this page and download the library: Download depa/middleware-formularhandler 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/ */

    

depa / middleware-formularhandler example snippets


    $app->route(
        '/formhandler[/]',
        [
            depa\FormularHandlerMiddleware\FormularHandlerMiddleware::class,
        ],
        ['POST'],
        'formHandler'
    );
   

  'adapter' => [
      'phpmail' => [
          'reply-to' => [
              'status' => true,
              'field'  => 'mail',
          ],
              'recipients' => ['[email protected]'],
              'subject'    => 'subject',
              'sender'     => '[email protected]',
              'senderName' => 'Form', 
              'template'   => 'Test {{message}} {{mail}}',
      ],
  ],
    

  'adapter' => [
      'smtpmail' => [
          //same as on phpmail but        'config' => [
                  'service'    => 'smtp.googlemail.com',
                  'port'       => '465',
                  'encryption' => 'ssl',
                  'email'      => '[email protected]',
                  'password'   => 'examplepw',
              ],
          ],
      ],
  ],
    

  'forms' => [
      'contact' => [
          'fields' => [
              ...
          ],
          'adapter' => [
              ...
          ],
      ],
  ],

'depaForm' => [
    'adapter' => [
        'globalTestAdapter-1' => [
            'smtpmail' => [
                'recipients'     => ['[email protected]'],
                'subject'        => 'base subject all forms that uses this specific adaper has',
                'sender'         => '[email protected]',
                'senderName'     => 'form',
                'template'       => 'nothing',
                'email_transfer' => [
                    'config' => [
                         'service'    => 'smtp.googlemail.com',
                         'port'       => '465',
                         'encryption' => 'ssl',
                         'email'      => '[email protected]',
                         'password'   => 'examplepw',
                    ],
                ],
            ],
        ],
    ],
],

'forms' => [
    'contact' => [
        'fields' => [
            ...
        ],
        'adapter' => [
            'globalTestAdapter-1' //or any other name you have used for an adapter.
        ],
    ],
],

'template' => 'my Name is {{name}}'

'reply-to' => [
    'status' => true,
    'field' => 'mail'
],

'forms' => [
    'contact' => [
        'fields' => [
            'someFieldName' => [
                'type' => 'email',
            ],
        ],
        'adapter' => [
            ...
        ],
    ],
],

'

'depaForm' => [
    'adapter' => [
        'globalExampleAdapter-1' => [
            'smtpmail' => [
                'recipients'     => ['[email protected]'],
                'subject'        => 'base subject all forms that uses this specific adaper has',
                'sender'         => '[email protected]',
                'senderName'     => 'Kontaktformular',
                'template'       => 'nothing',
                'email_transfer' => [
                    'config' => [
                        'service'    => 'smtp.example.com',
                        'port'       => '465',
                        'encryption' => 'ssl',
                        'email'      => '[email protected]',
                        'password'   => 'yourPassword',
                    ],
                ],
            ],
        ],
    ],
    'forms' => [
        'contact' => [
            'fields' => [
                'name' => [
                    '                'country' => [
                    '