PHPackages                             moirei/fields - 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. moirei/fields

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

moirei/fields
=============

A simple package for code-defined application inputs &amp; fields.

1.2.0(1mo ago)05181MITPHPPHP ^8.2

Since Nov 12Pushed 1mo agoCompare

[ Source](https://github.com/moirei/fields)[ Packagist](https://packagist.org/packages/moirei/fields)[ RSS](/packages/moirei-fields/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (15)Versions (8)Used By (1)

Simple Fields
=============

[](#simple-fields)

This package provides a simple solution for working with backend defined fields. Use cases:

- Backend defined forms fields
- Defined survey questionnaire with strict input types and valid values
- Define configuration application settings options with default values
- Fetch form data (including input type, validation rules, etc) from the backend for frontend display.

**Notes**

- This package was inspired by [Laravel Nova](https://nova.laravel.com/) fields.
- Field properties are aimed to be consistent with [Vuetify](https://vuetifyjs.com/en/components) form input component properties.

```
$field = Boolean::make('Enable notification')->default(false);
```

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

[](#installation)

```
composer require moirei/fields
```

Usage
-----

[](#usage)

```
use MOIREI\Fields\Inputs\Field;
use MOIREI\Fields\Inputs\{Text, Number, Select, Radio, Textarea};
...

$survey_questions = [
    Text::make('Whats your name?', 'name')
        ->rules('max:24')
        ->placeholder('John Doe')
        ->toArray(),

    Number::make('How old are you?', 'age')
        ->min(18)
        ->toArray(),

    Select::make('Gender')
        ->options([
            'Fridge',
            'Bridge',
            [ 'text' => 'I prefer not to say', 'value' => 'other' ],
        ])
        ->default('other')
        ->toArray(),

    Radio::make('Can keep you data for future promos?', 'subscribe')
        ->trueValue('Yes plez')
        ->falseValue('No thanks')
        ->toArray(),

    Textarea::make('More about yourself?', 'more')
        ->rows(10)
        ->hint('In a few words. Feel free to elaborate on the above.')
        ->persistentHint()
        ->toArray(),
];
```

### Validation

[](#validation)

```
$field = Text::make('Whats your name?', 'name')
        ->rules('max:24')
        ->placeholder('John Doe');

$valid = $field->validate('James Bond');
// or assert and throw exception
$field->validate('James Bond', true)
```

#### Validate multiple values

[](#validate-multiple-values)

```
$fields = [
    Text::make('Whats your name?', 'name')
        ->rules('max:24')
        ->placeholder('John Doe'),
    ...
];

$returnOnlyValidated = true;

$input = Field::validateInput($request->all(), $fields, $returnOnlyValidated)
```

Tests
-----

[](#tests)

```
composer test
```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance96

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

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

Recently: every ~397 days

Total

7

Last Release

49d ago

PHP version history (3 changes)1.0.0PHP ^8.0

1.1.0PHP ^7.4|^8.0

1.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ac6a15a7b2f9055a98e4419e0d2820f72db3567706837ec388baee535d3e3e7?d=identicon)[moirei](/maintainers/moirei)

---

Top Contributors

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

---

Tags

laravelSettingsforminputfieldsmoirei

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/moirei-fields/health.svg)

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

###  Alternatives

[anahkiasen/former

A powerful form builder

1.4k1.4M14](/packages/anahkiasen-former)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[barryvdh/laravel-form-bridge

This packages integrates Symfony Form Component in Laravel.

163354.8k1](/packages/barryvdh-laravel-form-bridge)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[inkvizytor/fluentform

Form builder for Laravel

3416.2k](/packages/inkvizytor-fluentform)

PHPackages © 2026

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