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(3mo ago)05181MITPHPPHP ^8.2

Since Nov 12Pushed 3mo agoCompare

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

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

46

—

FairBetter than 92% of packages

Maintenance80

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

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

106d 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M203](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k97](/packages/nativephp-mobile)[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 11, 12 and 13

217700.9k8](/packages/webwizo-laravel-shortcodes)

PHPackages © 2026

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