PHPackages                             lexal/form-submitter - 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. lexal/form-submitter

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

lexal/form-submitter
====================

Form submitter

v2.0.1(3mo ago)11.8k1MITPHPPHP &gt;=8.1CI passing

Since Mar 1Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/lexalium/form-submitter)[ Packagist](https://packagist.org/packages/lexal/form-submitter)[ RSS](/packages/lexal-form-submitter/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (10)Versions (5)Used By (1)

Form Submitter
==============

[](#form-submitter)

[![PHPUnit, PHPCS, PHPStan Tests](https://github.com/lexalium/form-submitter/actions/workflows/tests.yml/badge.svg)](https://github.com/lexalium/form-submitter/actions/workflows/tests.yml)

With this package you can submit a form entity, e.g. save it into the database. The package can be used with the [Stepped Form](https://github.com/lexalium/stepped-form) package on FormFinished event.

Requirements
------------

[](#requirements)

**PHP:** &gt;=8.1

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

[](#installation)

Via Composer

```
composer require lexal/form-submitter

```

Usage
-----

[](#usage)

1. Create a Form Submitter for the specific entity. Form Submitter can return data that will be passed back where `submit` method has been called.

    ```
    use Lexal\FormSubmitter\FormSubmitterInterface;

    final class CustomerFormSubmitter implements FormSubmitterInterface
    {
        public function supportsSubmitting(mixed $entity): bool
        {
            return $entity instanceof Customer;
        }

        public function submit(mixed $entity): mixed
        {
            // save entity to the database

            return $entity;
        }
    }
    ```
2. Use Form Submitter in your application.

    ```
    $entity = new Customer();
    $formSubmitter = new CustomerFormSubmitter();

    if ($formSubmitter->supportsSubmitting($entity)) {
        $formSubmitter->submit($entity);
    }
    ```

You can use the following build-in Form Submitters:

1. `FormSubmitter` - contains array of submitters and submit a form entity to the first one that supports submitting.

    ```
    use Lexal\FormSubmitter\FormSubmitter;

    $formSubmitter = new FormSubmitter(
        new CustomerFormSubmitter(),
    );

    $formSubmitter->submit(new Customer());
    ```
2. `TransactionalFormSubmitter` - submits a form entity in the transaction (e.g. database transaction).

    ```
    use Lexal\FormSubmitter\FormSubmitter;
    use Lexal\FormSubmitter\Transaction\TransactionInterface;
    use Lexal\FormSubmitter\TransactionalFormSubmitter;

    final class DatabaseTransaction implements TransactionInterface
    {
         public function start(): void
         {
             // start transaction
         }

         public function commit(): void
         {
             // commit transaction
         }

         public function rollback(): void
         {
             // rollback transaction
         }
    }

    $submitter = new TransactionalFormSubmitter(
         new FormSubmitter(new CustomerFormSubmitter()),
         new DatabaseTransaction(),
    );

    $submitter->submit(new Customer());
    ```

---

License
-------

[](#license)

Form Submitter is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance82

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

94d ago

Major Versions

v1.0.0 → v2.0.02023-12-26

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/e58c7184c9ec2cebd6c37bb1fbc98870dc0f43abeccc4f0c873edf364a11c321?d=identicon)[alexxxkk](/maintainers/alexxxkk)

---

Top Contributors

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

---

Tags

form submitterstepped form submitter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lexal-form-submitter/health.svg)

```
[![Health](https://phpackages.com/badges/lexal-form-submitter/health.svg)](https://phpackages.com/packages/lexal-form-submitter)
```

PHPackages © 2026

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