PHPackages                             petun/forms - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. petun/forms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

petun/forms
===========

Package for simple forms handle in any CMS or Frameworks

0661PHP

Since Mar 24Pushed 7y ago1 watchersCompare

[ Source](https://github.com/petun/forms)[ Packagist](https://packagist.org/packages/petun/forms)[ RSS](/packages/petun-forms/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Petun Forms
===========

[](#petun-forms)

Package for simple forms handle in any CMS or Frameworks.

Installation
------------

[](#installation)

```
git clone https://github.com/petun/forms.git
cd Forms
cp test/base_config.php config.php
cp test/handler.php .
php ~/composer.phar update

```

### Front End

[](#front-end)

```

```

In your main script file

```
$(function(){
    // this is default options
    $('.petun-form').ptmForm(
        {
            'renderTo': '.form-result',
            'successClass': 'form-result__success',
            'errorClass': 'form-result__error',
            'loadingClass': 'form-result__loading',
            'handler': 'assets/template/Forms/handler.php',
            'onSuccess': ...
        }
    );

    // simple js callback example
    $('.petun-form').ptmForm(
        {
            'handler': 'assets/template/Forms/handler.php',
            'onSuccess': function(form, result) {
                window.setTimeout(function(){$('#callbackForm').modal('toggle')} , 2000);
            }
        }
    );

    });

```

Add formId to forms

```

        Name

                ...

```

### Backend

[](#backend)

Config Example Configuration

```
$config = array(
	'feedbackForm' => array(
		'fields' => array(
			'name' => 'Ваще имя',
			'telephone' => 'Ваш телефон',
			'email' => 'Email',
			'select-box' => 'select-box',
			'check-test' => 'test check'
		),
		'rules' => array(
			array('name', 'required'),
			array('telephone', 'required'),
			array('email', 'email'),
		),
		'actions' => array(
			array(
				'mail', 'subject' => 'Новое письмо с сайта',
				'from' => 'no-reply@' . $siteName,
				'fromName' => 'Администратор',
				'to' => $mailTo
			),
		)
	),
);

```

Available Actions
-----------------

[](#available-actions)

```
array(
	array(
		'mail', 'subject' => 'Новое письмо с сайта',
		'from' => 'no-reply@' . $siteName,
		'fromName' => 'Администратор',
		'to' => $mailTo
	),
	array(
		'redirect', 'to' => '',
	),
	array(
	    'log', 'filename' => '/tmp/log.txt',
	),
	array(
		'modxResource',
		'coreCmsPath' => '/Users/petun/Sites/modx/core/',
		'resource' => array(
			'pagetitle' => array('eval' => '$this->_form->fieldValue("name")'),
			'parent' => array('value' => '0'),
			'template' => array('value' => '1'),
			'published' => array('value' => '1'),
			'description' => array('value' => 'sample description'),
			'introtext' => array('eval' => '$this->_form->fieldValue("telephone") . $this->_form->fieldValue("email")'),
			'tv' => array(
				'date' => array('value' => '2013-01-01 12:12'),
				'typeId' => array('value' => '3')
			)
		)
	)
)

```

Available Rules
---------------

[](#available-rules)

```
'rules' => array(
	array('field', 'required'),
	array('field', 'email', 'allowEmpty' => false),
	array('field', 'number', 'allowEmpty' => false),
	array('field', 'regex', 'rule' => '/\d+/', 'errorMessage' => 'В поле %s должны быть только числа'),
	array('field', 'date', 'allowEmpty' => false, 'format' => 'dd.mm.yyyy'),

),

```

Callback Form
-------------

[](#callback-form)

HTML on [example modal](https://github.com/petun/forms/blob/master/test/example_modal.html) page Script you can get from [example script](https://github.com/petun/forms/blob/master/frontend/js/script.js)

CSS Sample (SASS)

```
.form-result {
  margin: 0 0 10px;
  ul {
    li {
      list-style: none;
    }
  }

  &.form-result__error {
    p {
      color: #ff2f25;
    }
  }

  &.form-result__success {
    p {
      color: #1c801a;
    }
  }
}

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 98.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/96cc0442d68526d5ddde82ab3fb37a3965dd7249fdae0a413c1b40987e482140?d=identicon)[petun](/maintainers/petun)

---

Top Contributors

[![petun](https://avatars.githubusercontent.com/u/165169?v=4)](https://github.com/petun "petun (54 commits)")[![ignatenkovnikita](https://avatars.githubusercontent.com/u/4436320?v=4)](https://github.com/ignatenkovnikita "ignatenkovnikita (1 commits)")

### Embed Badge

![Health badge](/badges/petun-forms/health.svg)

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

PHPackages © 2026

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