Repository navigation
Releases: plin-code/laravel-custom-fields
Release list
v0.2.0
The package now ships Laravel Boost resources: a short guideline in resources/boost/guidelines/core.blade.php and an on demand custom-fields-development skill in resources/boost/skills. An agent working in an app that uses the package learns the trait, the value API, the query helpers, the config keys and how to add a field type.
Boost picks them up on php artisan boost:install, or on php artisan boost:update --discover in an app that already uses it. laravel/boost is only suggested, never required. No runtime code changed.
composer update plin-code/laravel-custom-fieldsFull changes in #6.
v0.1.1
With key_type set to uuid, both package tables now receive time ordered UUID v7 keys instead of random UUID v4 keys. Keys sort by creation time and no longer fragment the primary key index on insert, matching hosts that key their own models with HasUuids.
Existing keys stay valid and the column type does not change, so no migration is needed. The ulid and id key types are unchanged.
composer update plin-code/laravel-custom-fieldsFull changes in #5.
v0.1.0
Typed, extensible custom fields for Eloquent models, with filtering and sorting.
Your product defines the fields at runtime, your users fill them in, and the package
stores every value in a typed column, validates it, and exposes it to a request as a
filter and as a sort. Headless: no controllers, no routes, no UI.
Getting started
composer require plin-code/laravel-custom-fields
php artisan vendor:publish --tag="laravel-custom-fields"
php artisan migrateSet key_type and morph_key_type before migrating. Both accept id, uuid or ulid
and default to id. See the README.
What is in it
- Twelve field types: text, textarea, email, url, phone, number, decimal, boolean,
date, datetime, select, multiselect. Each owns its storage column, validation rules,
serialization, default and the query operations it declares. - Your own types: implement FieldType, register it, done. No change to the core.
- Stable slugs and option keys: a name can be renamed and an option deactivated
without touching the values already stored. - Partial and complete validation: a PATCH validates only what it sends, while a
complete write validates the state the record ends up with, stored values included. - Filtering and sorting through spatie/laravel-query-builder: equals, in, contains,
greater_than, less_than, between, is_null, is_not_null, contains_any, contains_all.
A field only ever exposes the operations its type can serve. - Configurable keys, tables, models and connections, plus five events and factories.
- English and Italian validation messages.
Requirements
PHP 8.4 or newer, Laravel 12 or 13.
Tested on SQLite, MySQL 8.4 and PostgreSQL 17, on PHP 8.4 and 8.5, on Linux and Windows.
Full Changelog: https://github.com/plin-code/laravel-custom-fields/commits/v0.1.0