PHPackages                             evista/perform - 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. evista/perform

ActiveLibrary

evista/perform
==============

A reverse Form API that builds and processes forms automatically - from markup.

0.1.3.1(9y ago)0321MITPHPPHP &gt;=5.5.0

Since Mar 10Pushed 9y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (6)Versions (8)Used By (0)

Perform
=======

[](#perform)

[![Latest Version on Packagist](https://camo.githubusercontent.com/844c8c0312df64dbbf80e016c0da5638934cbb5292a4de2d3bd090b5bccda507/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6576697374612f706572666f726d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evista/perform)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/4322f2917eb113a93b6b353138ac5a4c21ccc26c6d61bb8517f52c0f1bcd0164/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62616c696e74736572612f6576697374612d706572666f726d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/balintsera/evista-perform)[![Coverage Status](https://camo.githubusercontent.com/8c2fe444c2dbc6a0176098cb4d0e13e802e27628a7d067c39c3ba58daee75791/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6576697374612f706572666f726d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/evista/perform/code-structure)[![Quality Score](https://camo.githubusercontent.com/2417c60aa12d784518f7cd06eb6613b7dadbbc92c70349449e75a77d469a6e6c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6576697374612f706572666f726d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/evista/perform)[![Total Downloads](https://camo.githubusercontent.com/78c674ea02da52bc310d158213280a8f8662d21c3e82437971e6a360b5260802/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6576697374612f706572666f726d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evista/perform)

A reverse Form API that builds and processes forms automatically - from markup.

Install
-------

[](#install)

Via Composer

```
$ composer require evista/perform
```

Usage
-----

[](#usage)

```
$formService = new Service($crawler);
// Get form markup from the request to $formMarkup
$form = $formService->transpileForm($formMarkup);
```

Perform is based on a simple concept: build your form in plain ol' html in any template or any frontend like React.js then send it to the server. The backend will take care of building a form object *from your markup,* *populate* it from the request, and run your *validations*.

This differentiates it from all the other PHP form APIs, because there's no need to build any form object on the server side *before* submission.

Here is an example of a server side form building process:

```
use Evista\Perform\Service;

// (...)

// Initialize form transpilation service (dependency injection friendly interface)
$formService = new Service($crawler);

$router->addRoute('POST', '/loginform', function (Request $request, Response $response) use($formService) {
    $formMarkup = $request->request->get('serform');
    $form = $formService->transpileForm($formMarkup);

    // Get fields:
    $fields = $form->getFields();

    // Get an input field named 'email'
    $emailField = $form->getField('email');

    // Get the field's submitted value
    $emailField->getValue();

    // Get attributes, eg. placeholder:
    $placeholder = $emailField->getAttribute('placeholder');

    // Get selected option:
    $selectField = $form->getField('test-select');
    $selected = $selectField->getValue();

    // Get the default selected option (that is selected in markup)
    $defaultSelected = $selectField->getDefaultSelectedOption();

    // Get files and handle them (multiple/single file upload)
    try {
        $fileField = $form->getField('files');
    } catch (FormFieldException $formFieldException) {
        $response = new Response();
        $response->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
        $response->setContent('Error: ' . $formFieldException->getMessage());
        $response->send();
        return $response;
    }

    $uploadedFiles = $fileField->getFiles();
    foreach ($uploadedFiles as $uploadedFile) {
        // Check real file type:
        $realType = $uploadedFile->getRealType(); // eg. image/png

        $userAddedName = $uploadedFile->getUserName;

        // Move the file to its final destination
        $uploadedFile->moveToDestination($destination = '/var/uploads/');

        // Get safe file name
        $safeBaseName = $uploadedFile->getSafeName(); // no extension

        // Get the original extension from filename
        $userExtension = $uploadedFile->getUserExtension();
    }

     // Check validity
    if (!$form->isValid()) {
        // All errors can be spotted in the fields
        foreach ($form->getFields() as $field) {
            if (!$field->isValid()) {
                $validationErrors[] = $field->getErrors();
            }
        }

        // Or a lot more conveniently:
        // This returns an array of Evista\Perform\ValueObject\ValidationError objects
        $allValidationErrors = $form->getValidationErrors();
    }

    // Then send some response
    $response = new JsonResponse(['dump'=>(var_export($form, true))]);
    return $response;
});
```

After initializing the form builder call `transpileForm()` to build a Form object from the markup. The there's some helpful class methods to do whatever you have to, for example `getField($name)` to get any field's value.

```
$formMarkup = $request->request->get('serform');
$form = $formService->transpileForm($formMarkup);
```

The markup arrives with the submitted datas in the 'serform' post parameter. For example, this markup:

```

        Email:

        Pass:

        Longer description:

            Volvo
            Saab
            Mercedes
            Audi

  (function() {
    var form = document.getElementById('login-form');
    form.onsubmit = function() {

      // Three params: DOM, success callback and error callback:
      Perform.submit(
        form,
        function success(result) {
          console.log('mysuccess', result);
          var response = JSON.parse(result.target.response);
          var dumper = document.getElementById('dumper');
          dumper.innerHTML = response.dump;
        },
        function error(error) {
          console.log('myError', error);
        }
      );

      return false;
    };
  })();

```

There's a javascript file in `assets/bundle.js` that sends the form's data via POST to the form's destination (action parameter) via a global object called Perform.

There is a usage example of the package in this [repo](https://github.com/balintsera/evista-perform-example).

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Balint Sera](https://github.com/balintsera)
- [Zsolt Schutzbach](https://github.com/succli)
- [All Contributors](../../contributors)
- [Evista Creative Agency](http://evista-agency.com)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~61 days

Recently: every ~77 days

Total

6

Last Release

3405d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ab3f9b98b8874849b833ccc3b0dd415d8b116654b319d17e687c218e9021e87?d=identicon)[balintsera](/maintainers/balintsera)

---

Top Contributors

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

---

Tags

formevistaperform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/evista-perform/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[spatie/laravel-visit

Quickly visit any route of your Laravel app

15614.6k](/packages/spatie-laravel-visit)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)

PHPackages © 2026

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