PHP code example of genesis-dev / landing-form

1. Go to this page and download the library: Download genesis-dev/landing-form 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/ */

    

genesis-dev / landing-form example snippets



return [
    "db" => [ // Database settings
        'database_type' => '',
        'database_name' => '',
        'server' => '',
        'username' => '',
        'password' => '',
        'charset' => 'utf8',
    ],
    "telegram" => [ // Telegram settings
        "api_key" => "",
    ],
    "defaults" => [
        "mailer" => [ // SMTP settings
            "host" => '',
            "username" => '',
            "password" => '',
            "from" => '',
            "fromName" => "",
            "subject" => "",
            "to" => ["[email protected]", "[email protected]"],
        ],
        "telegram" => [
            "channel_name" => "", // Telegram channel name (without @)
            "


$config = [
    "defaults" => [
        "validators" => [
            "email" => function($str, $fields, $validators) { // $str - field value, $fields - other fields, $validators - other validators
                return !empty($str) && filter_var($str, FILTER_VALIDATE_EMAIL);
            },
            "phone" => function($str, $fields, $validators) {
                return !empty($str) && preg_match('/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}$/', $str);
            },
        ],
    ],
    "table" => "landing_form", // Table name in DB
];

//......