PHPackages                             romash1408/formchecker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. romash1408/formchecker

ActivePackage[Validation &amp; Sanitization](/categories/validation)

romash1408/formchecker
======================

Checks form fields and generates html-table to mail it to administrator

v1.0.2(8y ago)0248MITPHPPHP &gt;=5.3.0

Since Nov 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/romash1408/formchecker)[ Packagist](https://packagist.org/packages/romash1408/formchecker)[ RSS](/packages/romash1408-formchecker/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

FormChecker
===========

[](#formchecker)

Description
-----------

[](#description)

Makes similar checking of form fields filled on your web site. It verifies required fields, including email addresses (checks `@` existing and hostname MX record).
After that html report is generated and sent by [mail()](http://php.net/manual/ru/function.mail.php), or user custom function, callback called with filtered fields and autosend is sent by same method.

Install
-------

[](#install)

Via Composer

```
$ composer require romash1408/formchecker
```

Example
-------

[](#example)

```
require "vendor/autoload.php";

use R14\FormChecker;
use R14\FormException;

$usermail;

$checker = new FormChecker(
    $forms = [
		"mainform" =>
		[
			"subject" => "Test main form",
			"fields" =>
			[
                "name" => [
                    "placeholder" => "Name",
                ],
                "phone" => [
                    "type" => "tel",
                    "placeholder" => "Phone number",
                    "required" => true,
                ],
                "email" => [
                    "type" => "email",
                    "placeholder" => "E-mail",
                    "required" => true,
                ],
                "list" => [
                    "type" => "list",
                    "placeholder" => "List",
                    "required" => true,
                    "list" => [
                        "One", "Two", "Three",
                    ],
                ],
			],
			"callback" => function($fields) use(&$usermail)
			{

                $usermail = $fields["email"];
                // We can send post request with filtered and checked data to CRM server, if needed
                // $fields["key"] = "123456";
                // Formsender::post("https://crm-server.com", $fields);
			},
			"autosend" =>
			[
				"template" => function()
				{

                    return  function() use(&$usermail)
				{
					return [ $usermail ];
				},
				"subject" => function()
				{
					return "Answer to user";
				},
			],
			"to" => [ "admin@server" ],
        ],
        "contactform" => [
            "subject" => "Contact form",
            "fields" => [
                "author" => [
                    "type" => "email",
                    "placeholder" => "Author e-mail",
                    "required" => true,
                ],
                "message" => [
                    "type" => "textarea",
                    "placeholder" => "Message",
                    "required" => true,
                ],
            ],
            "to" => [ "moder@gmail.com" ],
        ],
    ],
    $config = [
       "send" => function ($mail) {
            echo '
            Sending mail to ' . implode(", ", $mail["to"]) . ' with subject "' . $mail["subject"] . '"
            ' . $mail["body"] . '
            ';
        },
    ]
);
```

Now we have `$checker` variable with information about all our forms and send function. To make magic just call `$checker->work()` with formname (`"default"` by default) and form fields array (`$_POST` + `$_FILES` by default), like this:

```
try
{
    $checker->work($_POST["formname"]);
}
catch (FormException $e)
{
    echo '' . $e->getMessage() . '';
}
```

### \#1

[](#1)

```
$_POST = [
    "formname" => "mainform",
];
```

#### Output:

[](#output)

> [![Field Phone number must not be empty](https://camo.githubusercontent.com/5403cc6ae3bd3cbb0402c71d2d9dfee58ca95f4cbbd70dc1a58978bb01169093/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f454d5054595f4649454c442e6a7067 "Field Phone number must not be empty")](https://camo.githubusercontent.com/5403cc6ae3bd3cbb0402c71d2d9dfee58ca95f4cbbd70dc1a58978bb01169093/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f454d5054595f4649454c442e6a7067)

### \#2

[](#2)

```
$_POST = [
    "formname" => "mainform",
    "phone" => "+7 (999) 999-99-9",
    "email" => "test",
];

try {

    $checker->work($_POST["formname"]);

} catch (FormException $e) {

    echo '' . $e->getMessage() . '';

}
```

#### Output:

[](#output-1)

> [![Incorrect phone number format](https://camo.githubusercontent.com/8b2bdf2c5f3d5b95138db8c9f9fdc3b8b9499121d24748af4ab23d4e9b0b12a8/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f50484f4e452e6a7067 "Incorrect phone number format")](https://camo.githubusercontent.com/8b2bdf2c5f3d5b95138db8c9f9fdc3b8b9499121d24748af4ab23d4e9b0b12a8/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f50484f4e452e6a7067)

### \#3

[](#3)

```
$_POST = [
    "formname" => "mainform",
    "phone" => "+7 (999) 999-99-99",
    "email" => "test@gmail.co",
];

try {

    $checker->work($_POST["formname"]);

} catch (FormException $e) {

    echo '' . $e->getMessage() . '';

}
```

#### Output:

[](#output-2)

> [![Incorrect email address format](https://camo.githubusercontent.com/b08c8064091bec63b817d80d8770cd9392c05928a8668b27e53a2f644e70c83b/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f454d41494c2e6a7067 "Incorrect email address format")](https://camo.githubusercontent.com/b08c8064091bec63b817d80d8770cd9392c05928a8668b27e53a2f644e70c83b/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f454d41494c2e6a7067)

### \#4

[](#4)

```
$_POST = [
    "formname" => "mainform",
    "name" => "Tester",
    "phone" => "+7 (999) 999-99-99",
    "email" => "test@gmail.com",
];

try {

    $checker->work($_POST["formname"]);

} catch (FormException $e) {

    echo '' . $e->getMessage() . '';

}
```

#### Output:

[](#output-3)

> [![Field List must not be empty](https://camo.githubusercontent.com/d0401e470384e8c7615577d5b71e8fba3c3e0d0c21fa9561bd87d8eea7522d82/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f454d5054595f4c4953542e6a7067 "Field List must not be empty")](https://camo.githubusercontent.com/d0401e470384e8c7615577d5b71e8fba3c3e0d0c21fa9561bd87d8eea7522d82/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f454d5054595f4c4953542e6a7067)

### \#5

[](#5)

```
$_POST = [
    "formname" => "mainform",
    "name" => "Tester",
    "phone" => "+7 (999) 999-99-99",
    "email" => "test@gmail.com",
    "list" => [
        "One", "Four",
    ],
];

try {

    $checker->work($_POST["formname"]);

} catch (FormException $e) {

    echo '' . $e->getMessage() . '';

}
```

#### Output:

[](#output-4)

> [![Did not found Four in List](https://camo.githubusercontent.com/c709db7e22d5c06268f4c1359fbf8bf6499ad34dce66bd709d14348eda5cff23/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f4c4953542e6a7067 "Did not found Four in List")](https://camo.githubusercontent.com/c709db7e22d5c06268f4c1359fbf8bf6499ad34dce66bd709d14348eda5cff23/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f57524f4e475f4c4953542e6a7067)

### \#6

[](#6)

```
$_POST = [
    "formname" => "mainform",
    "name" => "Tester",
    "phone" => "+7 (999) 999-99-99",
    "email" => "test@gmail.com",
    "list" => [
        "One", "Three",
    ],
];

try {

    $checker->work($_POST["formname"]);

} catch (FormException $e) {

    echo '' . $e->getMessage() . '';

}
```

#### Output:

[](#output-5)

> [![Result of sending main form](https://camo.githubusercontent.com/a2e1e8b876c53c597852c9b312960fd27eac8db1e075a89c00bc4d38c17af887/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f4d41494e5f464f524d5f53454e542d322e6a7067 "Result of sending main form")](https://camo.githubusercontent.com/a2e1e8b876c53c597852c9b312960fd27eac8db1e075a89c00bc4d38c17af887/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f4d41494e5f464f524d5f53454e542d322e6a7067)

### \#7

[](#7)

```
$_POST = [
    "formname" => "contactform",
    "author" => "work@romash1408.ru",
    "message" => getMessage() . '';

}
```

#### Output:

[](#output-6)

> [![Result of sending contact form](https://camo.githubusercontent.com/d98eb29316cfb48e680f8b6424f52102b1367810852d1c343005114ea1369c7b/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f434f4e544143545f464f524d5f53454e542e6a7067 "Result of sending contact form")](https://camo.githubusercontent.com/d98eb29316cfb48e680f8b6424f52102b1367810852d1c343005114ea1369c7b/68747470733a2f2f726f6d617368313430382e72752f756e746f75636861626c652f6769746875622d666f726d636865636b65722f726561646d652f434f4e544143545f464f524d5f53454e542e6a7067)

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Total

3

Last Release

3090d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14085271?v=4)[Roman Dubinin](/maintainers/romash1408)[@romash1408](https://github.com/romash1408)

---

Top Contributors

[![romash1408](https://avatars.githubusercontent.com/u/14085271?v=4)](https://github.com/romash1408 "romash1408 (4 commits)")

### Embed Badge

![Health badge](/badges/romash1408-formchecker/health.svg)

```
[![Health](https://phpackages.com/badges/romash1408-formchecker/health.svg)](https://phpackages.com/packages/romash1408-formchecker)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
