Back to demos

Documentation

This guide covers installation, configuration and how to connect the HTML demos to the single PHP handler that powers validation, file uploads and email notifications.

Basics

Requirements & compatibility

Migo Contact is designed to run on standard shared hosting and simple PHP setups. No database is required.

  • PHP: 8.1+ (recommended 8.2+).
  • Extensions: mbstring, json, fileinfo, filter, openssl.
  • Web server: Apache, Nginx or any server that can run PHP.
  • Email: standard PHP mail transport or SMTP via PHPMailer (configured in config/config.php).

You can use the kit with:

  • Static HTML sites (embed the forms where you need them).
  • Custom PHP projects or frameworks.
  • CMS / themes (WordPress, etc.) as a standalone form handler folder.

Migo Contact ships with PHPMailer out of the box. SMTP and email options are configured in config/config.php. If you prefer a different mail setup, you can adapt src/Mailer.php or public/ajax/handle-form.php.

Step 1

Quick start

Migo Contact is a compact PHP kit. Drop the folder into your project, configure one global file plus one config per form, then point your HTML forms to public/ajax/handle-form.php. No database is needed.

  1. Upload the migo-contact folder to your hosting.
  2. Open config/config.php and set admin_email, SMTP options and other global settings.
  3. Include one of the demo forms (or your own) in your page and keep class="m-form" and a unique data-m-id.
  4. Make sure form_id in the hidden input, data-m-id and the config filename in config/forms/ all use the same value (for example contact-basic).
  5. Ensure your PHP server has the fileinfo extension enabled for uploads.

If you install the kit in a different folder (for example /forms-kit instead of /migo-contact), just adjust the action URL accordingly.

<form
    class="m-form"
    data-m-id="contact-basic"
    action="/migo-contact/public/ajax/handle-form.php"
    method="post"
    enctype="multipart/form-data"
>
    <input type="hidden" name="form_id" value="contact-basic">
    …
</form>
Overview

Folder structure

A typical installation looks like this (the root folder name may differ on your server):

migo-contact/
├── changelog.txt
├── license.txt
├── readme.txt
├── config/
│   ├── config.php          # Global settings (emails, uploads, rate limits…)
│   ├── forms/
│   │   ├── contact-attachments.php
│   │   ├── contact-basic.php
│   │   ├── job-application.php
│   │   ├── newsletter-subscribe.php
│   │   ├── project-quote.php
│   │   └── support-ticket.php
│   └── mail/
│       ├── admin-notification.phtml
│       └── autoresponder.phtml
├── demo/
│   ├── contact-attachments.phtml
│   ├── contact-basic.html
│   ├── index.html          # Demo index with links to all examples
│   ├── job-application.phtml
│   ├── newsletter-subscribe.html
│   ├── project-quote.phtml
│   ├── support-ticket.phtml
│   ├── thank-you-newsletter.html
│   └── thank-you.html
├── docs/
│   ├── index.html          # This documentation
│   └── assets/
│       └── docs.css
├── examples/
│   ├── contact-attachments-example.php
│   ├── contact-basic-example.php
│   ├── index.html
│   ├── job-application-example.php
│   ├── newsletter-subscribe-example.php
│   ├── project-quote-example.php
│   ├── README.txt
│   └── support-ticket-example.php
├── public/
│   ├── helpers-frontend.php
│   ├── ajax/
│   │   └── handle-form.php # Single AJAX handler for all forms
│   └── assets/
│       ├── css/
│       │   ├── forms-demo.css
│       │   └── forms.css   # Shared front-end styles (.m-* classes)
│       └── js/
│           └── forms.js    # Front-end logic (validation, uploads, wizard…)
├── src/
│   ├── FormHandler.php
│   ├── Helpers.php
│   ├── Mailer.php
│   ├── RateLimiter.php
│   ├── Response.php
│   ├── SubmissionLogger.php
│   ├── UploadManager.php
│   └── Validator.php
├── storage/
│   ├── rate-limit.json     # Simple storage for rate limiting
│   ├── submissions.log     # Optional log of processed submissions
│   └── uploads/
│       └── YYYY/
│           └── MM/
│               └── [uploaded files]
└── vendor/
    ├── autoload.php
    └── phpmailer/
        ├── src/
        └── language/       # PHPMailer translations

Some files (like changelog.txt, license.txt, readme.txt and print_tree.php) are mostly for documentation and development. The core runtime for the kit lives in config/, public/, src/, storage/ and vendor/.

You can safely move or rename the root folder as long as internal paths in your HTML action, <link> and <script> tags are updated.

Config

Global configuration (config.php)

The file config/config.php defines the defaults shared by all forms: email settings, upload limits, rate limiting and logging.

return [
    'email' => [
        'admin_email' => 'you@example.com',
        'from_email'  => 'no-reply@example.com',
        'from_name'   => 'Migo Contact',
        // SMTP options are also configured here (see the actual file).
    ],

    'upload' => [
        'max_files'          => 5,
        'max_size'           => 10 * 1024 * 1024, // 10 MB in bytes
        'allowed_extensions' => ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'zip'],
    ],

    'rate_limit' => [
        'window_seconds' => 300,  // seconds
        'max_attempts'   => 5,    // max submissions per IP per window
    ],
];

Each form can override these defaults in its own config file – for example, only images on a contact form, but PDFs and documents on a job application.

Per form

Per-form configuration

Every demo has a matching config file in config/forms/<form-id>.php. The form_id in your HTML must match both the config filename and the data-m-id.

// config/forms/contact-basic.php
return [
    'id'   => 'contact-basic',
    'name' => 'Contact form',

    'email' => [
        'subject_admin'      => 'New contact message',
        'send_autoresponder' => true,
        'subject_user'       => 'We received your message',
    ],

    // Optional per-form upload overrides
    'upload' => [
        'max_files' => 0, // no files for this form
    ],
];

You can also add validation rules, custom redirect URLs and other options inside the per-form config (see the included forms in config/forms/).

Front-end

Front-end HTML & attributes

The front-end uses a small set of data attributes for validation and file upload limits. JavaScript automatically binds to .m-form.

  • data-m-id – form ID, must match the config and form_id.
  • data-m-minlength, data-m-maxlength – per-field length limits.
  • data-m-dropzone – name of the file group used to connect the input with its preview container.
  • data-m-result – container for global success/error messages.
<form class="m-form"
      data-m-id="contact-basic"
      action="../public/ajax/handle-form.php"
      method="post"
      enctype="multipart/form-data"
      novalidate>

    <input type="hidden" name="form_id" value="contact-basic">

    <label class="m-label" for="cb_name">Full name</label>
    <input class="m-input"
           type="text"
           id="cb_name"
           name="name"
           required
           data-m-minlength="2"
           data-m-maxlength="120">

    <div class="m-alert" data-m-result></div>
</form>
Backend

AJAX handler (handle-form.php)

All forms submit to a single backend endpoint: public/ajax/handle-form.php. It reads form_id, loads the matching config, validates fields, processes file uploads and returns JSON.

// Simplified example, real file includes error handling
$formId = $_POST['form_id'] ?? '';

$configPath = __DIR__ . '/../../config/forms/' . $formId . '.php';
if (!is_file($configPath)) {
    echo json_encode([
        'status'  => 'error',
        'message' => 'Unknown form.',
    ]);
    exit;
}

$formConfig = require $configPath;

// … validate fields, handle uploads, send emails …

echo json_encode([
    'status'        => 'success',
    'message'       => 'Form submitted successfully.',
    'redirect_url'  => '/migo-contact/demo/thank-you.html', // optional
]);
Tip: you can set a different redirect_url for each form in its config (for example, a generic “Thank you” page for contacts and an HR-specific page for job applications).
Email

Email & autoresponder

Migo Contact can send one or two emails per submission: an admin notification and an optional autoresponder for the user.

  • Admin email – sent to admin_email with all submitted fields.
  • Autoresponder – a short confirmation sent to the user’s email address.

Subjects, recipients and whether to send an autoresponder are controlled in each form’s config file.

Uploads

File uploads

Upload limits are defined in bytes and enforced both on the client (via data attributes) and on the server.

The helper helpers-frontend.php generates the correct data-m-max-files, data-m-max-size and data-m-allowed-ext attributes for each file input, so you don’t have to repeat the numbers in HTML.

<input
    class="m-file"
    type="file"
    name="attachments[]"
    multiple
    <?php echo m_file_input_attrs('support-ticket'); ?>
>
Security

Security & anti-spam

Migo Contact ships with several built-in protections:

  • Hidden honeypot field (bots that fill it are rejected).
  • Rate limiting by IP (simple in-file counter using storage/rate-limit.json).
  • Strict file extension and MIME checks using finfo.
  • Server-side validation for required fields and length limits.

All error messages are returned as JSON, so the front-end can display them inline or as a global alert without reloading the page.

Envato

Envato install notes

When you purchase Migo Contact from Envato, you receive a .zip archive that contains the product files and this documentation.

  • Unzip the archive locally on your computer.
  • Upload the migo-contact product folder to your hosting account via FTP or File Manager.
  • Keep the docs/ folder either online (for your own reference) or locally on your machine.
  • Point your live website forms to /migo-contact/public/ajax/handle-form.php (or the adjusted path if you renamed the folder).

For Envato review and for your own testing, the main entry points are:

  • demo/index.html – demo showcase with all forms.
  • docs/index.html – this documentation.
  • examples/index.html – PHP integration examples matching each form.
Tip: you can safely rename the root folder (for example forms-kit instead of migo-contact) as long as you keep internal paths consistent in your HTML action and <link>/<script> tags.
Releases

Changelog & version history

This section summarises the changes between versions of Migo Contact. Versions follow semantic versioning:

  • MAJOR – breaking changes, large refactors, new architecture.
  • MINOR – new features and improvements that stay backward compatible.
  • PATCH – bug fixes and small adjustments only.

Example: 1.2.3major 1, minor 2, patch 3.

  • v1.0.0 – 28 November 2025 – Initial public release
    • 6 ready-made demos: simple contact, contact + attachments, project quote wizard, support ticket, job application and newsletter subscribe.
    • Single PHP handler with JSON responses and per-form configs.
    • Client-side validation, drag & drop uploads, multi-step wizard.
    • Global config + per-form overrides for emails, uploads and security.
    • Built-in rate limiting, honeypot anti-spam and MIME/extension checks.
    • PHPMailer integration with SMTP support.
    • Documentation, examples and demo pages included.

Future updates will be listed above v1.0.0, with the latest version at the top. For a plain-text version of the changelog you can also check: changelog.txt in the project root.

Upgrade

How to update from a previous version

Updating to a new version of Migo Contact is usually straightforward, but it is important to keep a backup and avoid overwriting your own customisations.

1. Make a backup

  • Download your current migo-contact folder via FTP or your hosting file manager.
  • If you modified any files (for example configs or CSS), keep a copy on your computer.
  • Optionally, create a backup of your whole site before updating.

2. Review the changelog

  • Check the Changelog section above or changelog.txt to see what changed.
  • Pay attention to notes about breaking changes or manual merge steps.

3. Unzip the new version locally

  • Download the latest version from your Envato Downloads page.
  • Unzip the archive on your computer and locate the migo-contact folder.

4. Replace core files (minor / patch updates)

  • Upload and overwrite these folders from the new version:
    • public/ajax/
    • public/assets/css/
    • public/assets/js/
    • docs/ (optional but recommended)
  • Do not overwrite your customised config files without checking: config/config.php and config/forms/*.php.

5. Merge configuration changes

  • If the new version introduces extra options in config/config.php or per-form configs, compare files side by side.
  • Copy new options into your existing configs instead of replacing the whole file, so you do not lose your email addresses, limits or custom labels.

6. Clear caches

  • Clear your browser cache and hard refresh the page with the forms.
  • If you use any caching plugins, CDN or reverse proxy, clear those caches as well.

7. Test the forms

  • Submit each demo you actually use (contact, support ticket, job application, etc.).
  • Check that validation works, files upload correctly and emails are received.
  • If something does not work as expected, temporarily enable error logging on your server and review the PHP error log.

For major upgrades (for example, from 1.x to 2.x), carefully follow the notes in changelog.txt. Large updates may ship with separate migration instructions in the package.

Support

Help & contact

Migo Contact is designed to be plug-and-play, but if you get stuck you can contact us. Support is available for verified Envato buyers during the active support period.

Before opening a ticket, we recommend that you:

  • Double-check your config/config.php settings (emails, paths, upload limits, rate limiting).
  • Confirm the form_id matches the config filename and data-m-id.
  • Test the demos on your server (for example the contact form and support ticket).

When you contact support, please include:

  • Your Envato username and purchase code.
  • The URL where the form is installed (if public).
  • Your PHP version and type of hosting (shared / VPS / local).
  • A short description of the issue and the exact steps to reproduce it.
  • Screenshots and any error messages from the browser console or PHP logs, if available.

What we can usually help with:

  • Installation issues and basic setup on a standard hosting environment.
  • Configuration of the included forms and email/autoresponder options.
  • Bug reports and fixes related to the original item.
  • Small examples for integrating the kit into your existing PHP project.

What is normally not covered by standard Envato item support:

  • Custom features or new functionality not included in the item.
  • Deep integration with third-party systems (CRMs, custom APIs, complex apps).
  • Server administration, mail server configuration or domain/DNS issues.
  • Design work for your entire website or building full pages from scratch.
  • Envato support – open a ticket from your Envato downloads page after purchasing the item.
  • Email support – contact admin@migo.support with the details listed above.