PHPackages                             ajaykushwaha111/laravel-validation-generator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ajaykushwaha111/laravel-validation-generator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

ajaykushwaha111/laravel-validation-generator
============================================

Generate Laravel FormRequest validation rules from database schema.

v1.0.0(4mo ago)26↓93.3%MITPHPPHP ^8.2

Since Feb 16Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/AjayKushwaha111/laravel-validation-generator)[ Packagist](https://packagist.org/packages/ajaykushwaha111/laravel-validation-generator)[ RSS](/packages/ajaykushwaha111-laravel-validation-generator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel Validation Generator
============================

[](#laravel-validation-generator)

[![Laravel](https://camo.githubusercontent.com/934c60d4b198c50fe53587c7ef11138695a83b6f668b40ef8f995dab4ac7b805/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d726564)](https://camo.githubusercontent.com/934c60d4b198c50fe53587c7ef11138695a83b6f668b40ef8f995dab4ac7b805/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d726564)[![PHP](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)

🚀 Automatically generate Laravel FormRequest validation rules directly from your database schema — and optionally sync model `$fillable` properties.

---

✨ Features
----------

[](#-features)

- 🔍 Generate **Store &amp; Update FormRequest** classes
- 🧠 Smart schema-based validation rule detection
- 🔐 Auto-detect `unique` indexes
- 🔗 Auto-detect foreign keys (`exists` rules)
- 🧾 Enum rule detection
- 🧩 UUID / ULID support
- 📦 Automatically sync model `$fillable`
- ⚡ Supports Laravel 10, 11, 12
- 🛠 Fully configurable via config file

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require ajaykushwaha111/laravel-validation-generator
```

Publish configuration (optional):

```
php artisan vendor:publish --tag=validation-generator-config
```

---

🚀 Usage
-------

[](#-usage)

Generate validation for all tables

```
php artisan validation:generate
```

Generate for specific table

```
php artisan validation:generate --table=users
```

Overwrite existing request files

```
php artisan validation:generate --force
```

Generate only Store request

```
php artisan validation:generate --store-only
```

Generate only Update request

```
php artisan validation:generate --update-only
```

---

🧠 Example Output
----------------

[](#-example-output)

Migration

```
$table->string('email')->unique();
$table->string('name', 255);
$table->uuid('uuid')->unique();
$table->foreignId('role_id')->constrained();
```

Generated Store Request

```
'email' => [
    'required',
    'string',
    'email',
Rule::unique('users','email'),
],

'name' => [
    'required',
    'string',
    'max:255',
],

'uuid' => [
    'required',
    'uuid',
    Rule::unique('users','uuid'),
],

'role_id' => [
    'required',
    'integer',
    'exists:roles,id',
],
```

---

🧱 Model `$fillable` Sync
------------------------

[](#-model-fillable-sync)

If your model does not contain `$fillable`, it will automatically be generated:

```
protected $fillable = [
    'email',
    'name',
    'uuid',
    'role_id',
];
```

If `$fillable` already exists, it will not be modified.

---

⚙ Configuration
---------------

[](#-configuration)

Configuration file:

```
config/validation-generator.php
```

You can customize:

- Skipped tables
- Skipped columns
- Smart field name rules
- Type mapping logic
- Custom rule detection behavior

---

🧩 Supported Schema Types
------------------------

[](#-supported-schema-types)

- `string`, `char`, `text`, `longText`
- `integer`, `bigInteger`, `smallInteger`
- `decimal`, `float`, `double`
- `boolean`
- `date`, `datetime`, `timestamp`
- `time`
- `year`
- `json`
- `enum`
- `uuid`
- `ulid`
- foreign keys
- unique indexes

---

🛡 Requirements
--------------

[](#-requirements)

- PHP 8.2+
- Laravel 10 / 11 / 12

---

📜 License
---------

[](#-license)

This package is open-sourced software licensed under the MIT license.

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome.

If you discover bugs or have feature suggestions, feel free to open an issue or submit a pull request.

---

⭐ Support
---------

[](#-support)

If you find this package useful, consider starring the repository on GitHub.

---

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance75

Regular maintenance activity

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35ee51af32fcca6b8bc93ce5ff5af30cde882ccb7a76863b7f4832d0cb3465d9?d=identicon)[AjayKushwaha111](/maintainers/AjayKushwaha111)

---

Top Contributors

[![AjayKushwaha25](https://avatars.githubusercontent.com/u/62894103?v=4)](https://github.com/AjayKushwaha25 "AjayKushwaha25 (1 commits)")

### Embed Badge

![Health badge](/badges/ajaykushwaha111-laravel-validation-generator/health.svg)

```
[![Health](https://phpackages.com/badges/ajaykushwaha111-laravel-validation-generator/health.svg)](https://phpackages.com/packages/ajaykushwaha111-laravel-validation-generator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[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)

PHPackages © 2026

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