laracraft-tech/laravel-schema-rules
Laravel Schema Rules automatically generates basic Laravel validation rules from your database table schema, giving you a starting point to fine-tune validation. Install as a dev dependency and generate rules for whole tables or specific columns.
schema:generate-rules {table}), with an optional --create-request flag that emits a ready-to-edit Form Request class (including nested Api\V1\... namespaces). The buy decision is easy: MIT, dev-only, ~360 stars, actively maintained (Laravel 11/12/13 support shipping through v1.6.0), so the alternative is a few days of internal tooling that nobody will maintain.persons-style record with strings, enums, FK, dates, nullable numerics), the generated rules give a concrete, reviewable artifact in minutes. That artifact is a useful estimating input: it exposes required vs. optional fields, max lengths, enum values, FK targets, and integer ranges before the form or API is built — surface area that usually gets discovered mid-sprint.max from string(100), in: from column enums, exists: from FK constraints, min/max from numeric type ranges, and nullable from nullability. That makes database constraints and application validation start from the same source of truth, which is a real reliability win versus hand-typed rules that quietly rot as migrations change.skip_columns (defaults to created_at/updated_at/deleted_at) is the kind of small config knob that makes a convention actually stick.Adopt when most of the following hold:
composer require --dev means no runtime surface, no added attack surface, no deployment weight. The cost of trying it is a branch and an hour.Look elsewhere — or treat it as a partial aid only — when:
float, decimal, and double collapse to ['required', 'numeric'] with no precision or scale handling — a gap that matters for money, measurements, and anything financial. Plan for manual rules on those columns.required_if, prohibited_unless), nested array validation, file uploads, or authorization — and no custom messages or attribute names. Form Requests will still need meaningful hand-editing; budget for it.The one-liner for executives: a small, free, developer-only tool that auto-drafts Laravel validation rules from our database schema, cutting the repetitive part of building forms and APIs while making validation start out consistent with the database.
The case in three points:
exists: on a foreign key. Generating from the schema makes those mismatches structurally less likely at the start of a feature, which is where they are cheapest to prevent.--dev), so it ships nothing to production. Actively maintained, with Laravel 13 support landing in the current release. If it disappoints, removal is one composer command — there is no migration, no runtime coupling, no vendor lock-in.What to be honest about with engineering:
decimal/float/double degrade to numeric with no precision or scale; those rules must be written by hand every time.Recommended framing of the ask: a timeboxed trial on one upcoming CRUD-heavy feature, with adoption judged on how much of the generated rule set survives review unchanged. If most of it survives, standardise on "generate, then fine-tune" as the team convention; if reviewers rewrite the bulk of it, we keep writing rules by hand and lose an afternoon.
How can I help you explore Laravel packages today?