Skip to content
This documentation is in construction.

Property Types

All built-in property types share the fluent API from BaseProperty:

  • ->title(?string $title)
  • ->description(?string $description)
  • ->optional(bool $optional = true)
  • ->nullable(bool $nullable = true)

Each concrete property type also exposes its own ->default(...) method with a type-safe signature.

Quick Finder

Use this table to find the right property quickly, then jump to the detailed section below.

PropertyCategoryBest forDefaultKey methods
StringPropertyScalarText and formatted string valuesstring|null|Closureformat, minLength, maxLength, pattern
BooleanPropertyScalarToggles and confirmationsbool|null|Closureaccepted
IntegerPropertyScalarCounters and whole numbersint|null|Closureminimum, maximum, multipleOf
FloatPropertyScalarRates, prices, and decimal valuesfloat|null|Closureminimum, maximum, multipleOf
EnumPropertyChoiceControlled value setsstring|int|null|Closurecases, dynamic, resolver
ObjectPropertyStructuredNested keyed objectsarray|null|Closureproperties, additionalProperties
ArrayPropertyStructuredOrdered listsarray|null|Closureitems, minItems, maxItems, uniqueItems
Scalar String values

StringProperty

Use for free text and formatted string values.

Default Signature

->default(string|null|Closure $default)

Fluent API

  • ->format(?StringFormat $format)
  • ->minLength(?int $minLength)
  • ->maxLength(?int $maxLength)
  • ->pattern(?string $pattern)

Key Behaviors

  • Supports plain text and format-aware strings such as `EMAIL`, `URL`, `DATE`, `TIME`, `MARKDOWN`, and `HTML`.
  • Regex patterns are exported to validation rules and JSON Schema when applicable.

Export Notes

  • Maps to specialized Filament inputs for several formats.
  • JSON Schema uses `type: string` and adds `format`, `minLength`, `maxLength`, or `pattern` when defined.

Example

use Epsicube\Schemas\Enums\StringFormat;
use Epsicube\Schemas\Properties\StringProperty;
StringProperty::make()
->title('Webhook URL')
->format(StringFormat::URL)
->maxLength(255)
->optional();

Notes

Not every StringFormat currently maps to a dedicated Laravel rule. EMAIL, URL, IPV4, IPV6, UUID, DATE, DATE_TIME, and TIME are handled directly today.

Scalar Boolean values

BooleanProperty

Use for true/false values, confirmations, and acceptance gates.

Default Signature

->default(bool|null|Closure $default)

Fluent API

  • ->accepted(bool $accepted = true)

Key Behaviors

  • `accepted()` requires the final value to be `true`.
  • Nullable booleans are supported and rendered explicitly in prompts and Filament.

Export Notes

  • Validation exports `boolean`, plus `accepted` when requested.
  • Filament uses boolean toggle buttons and a nullable state cast when needed.

Example

use Epsicube\Schemas\Properties\BooleanProperty;
BooleanProperty::make()
->title('Accept terms')
->accepted()
->optional();
Scalar Integer values

IntegerProperty

Use for counters, limits, retries, and any whole-number value.

Default Signature

->default(int|null|Closure $default)

Fluent API

  • ->minimum(int $minimum, bool $exclusive = false)
  • ->maximum(int $maximum, bool $exclusive = false)
  • ->multipleOf(int $multiple)

Key Behaviors

  • Supports inclusive and exclusive min/max boundaries.
  • Supports divisibility constraints with `multipleOf()`.

Export Notes

  • JSON Schema uses `type: integer` with boundary fields.
  • Validation exports `integer` plus min/max or custom exclusive checks.

Example

use Epsicube\Schemas\Properties\IntegerProperty;
IntegerProperty::make()
->title('Retry count')
->minimum(0)
->maximum(10)
->default(3)
->optional();
Scalar Float values

FloatProperty

Use for prices, rates, percentages, and any decimal value.

Default Signature

->default(float|null|Closure $default)

Fluent API

  • ->minimum(float $minimum, bool $exclusive = false)
  • ->maximum(float $maximum, bool $exclusive = false)
  • ->multipleOf(float $multiple)

Key Behaviors

  • Supports inclusive and exclusive min/max boundaries.
  • Supports step-like precision constraints with `multipleOf()`.

Export Notes

  • JSON Schema uses `type: number`.
  • Validation exports `numeric` plus boundaries and `multiple_of`.

Example

use Epsicube\Schemas\Properties\FloatProperty;
FloatProperty::make()
->title('Tax rate')
->minimum(0)
->maximum(1)
->multipleOf(0.01)
->optional();
Choice Controlled values

EnumProperty

Use when a value must come from a controlled list of string or integer cases.

Default Signature

->default(string|int|null|Closure $default)

Fluent API

  • ->resolver(?EnumResolver $resolver)
  • ->cases(EnumCase ...$cases)
  • ->dynamic(Closure $callback)

Key Behaviors

  • Define exactly one enum source: static cases, dynamic callback, or a resolver.
  • Dynamic cases are evaluated lazily at runtime.

Export Notes

  • JSON Schema exports an `enum` array and optional `$meta` data.
  • Validation exports an `in:` rule based on resolved cases.
  • Filament and prompts both render a select-like choice UI.

Example

use Epsicube\Schemas\Properties\EnumProperty;
use Epsicube\Schemas\Types\EnumCase;
EnumProperty::make()
->title('Status')
->cases(
EnumCase::make('draft', 'Draft'),
EnumCase::make('published', 'Published'),
EnumCase::make('archived', 'Archived'),
)
->default('draft')
->optional();

Notes

Calling cases() after dynamic(), or the reverse, raises a LogicException.

Structured Nested objects

ObjectProperty

Use for nested keyed data such as credentials, settings groups, or embedded payloads.

Default Signature

->default(array|null|Closure $default)

Fluent API

  • ->properties(array $properties)
  • ->additionalProperties(bool|Property $additionalProperties = true)

Key Behaviors

  • `properties()` defines the child property map.
  • `additionalProperties(false)` prohibits unknown keys.
  • `additionalProperties(true)` preserves unknown keys.
  • `additionalProperties(Property)` validates unknown keys against a fallback property definition.

Export Notes

  • JSON Schema exports an object with `properties`, `required`, and `additionalProperties`.
  • Validation recursively exports child rules and can prohibit or type-check unknown keys.
  • Filament renders a grouped `Section` with nested fields.

Example

use Epsicube\Schemas\Properties\BooleanProperty;
use Epsicube\Schemas\Properties\ObjectProperty;
use Epsicube\Schemas\Properties\StringProperty;
ObjectProperty::make()
->title('Credentials')
->properties([
'username' => StringProperty::make()->title('Username'),
'password' => StringProperty::make()->title('Password'),
'remember' => BooleanProperty::make()->optional()->default(false),
])
->additionalProperties(false);
Structured Ordered lists

ArrayProperty

Use for ordered lists of scalar or object items.

Default Signature

->default(array|null|Closure $default)

Fluent API

  • ->items(Property $item)
  • ->minItems(?int $min)
  • ->maxItems(?int $max)
  • ->uniqueItems(bool $unique = true)

Key Behaviors

  • `items()` defines the schema of each list item.
  • `uniqueItems()` enforces distinct values.
  • Supports minimum and maximum list sizes.

Export Notes

  • JSON Schema exports `type: array` plus item and size constraints.
  • Validation generates child rules per index for clearer errors.
  • Prompts export a small array editor with add, edit, delete, and finish actions.

Example

use Epsicube\Schemas\Properties\ArrayProperty;
use Epsicube\Schemas\Properties\StringProperty;
ArrayProperty::make()
->title('Allowed hosts')
->items(
StringProperty::make()->title('Host')
)
->minItems(1)
->uniqueItems()
->optional();

Notes

Array validation is list-oriented. When items() is set, child rules are emitted per index to preserve precise error reporting.