PHPackages                             jshibu86/validator - 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. jshibu86/validator

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

jshibu86/validator
==================

A Laravel package to generate validation rules for database tables

2.0.0(1y ago)07MITPHPPHP ^8.2|^8.3|^8.4

Since Mar 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jshibu86/validator)[ Packagist](https://packagist.org/packages/jshibu86/validator)[ RSS](/packages/jshibu86-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Schema Validation Generator
===========================

[](#schema-validation-generator)

**Schema Validation Generator** is a Laravel package designed to simplify the creation of validation rules for database tables. This package dynamically generates a validation array based on the schema of a specified table, helping you reduce manual effort and improve consistency.

---

Features
--------

[](#features)

- Generate validation rules for any database table with a single command.
- Automatically detects column properties such as `nullable`, `type`, and `length` to create appropriate rules.
- Supports common validation rules like `required`, `nullable`, `string`, `integer`, `numeric`, `boolean`, `date`, and more.
- Provides a clean, readable output in PHP array format.

---

Installation
------------

[](#installation)

To install the package, run: Latest Version:

```
composer require jshibu86/validator
```

---

Latest 1.x.x version:

```
composer require jshibu86/validator:^1.0
```

---

Version 1.0.0:

```
composer require jshibu86/validator:1.0.0
```

---

Latest 2.x.x version:

```
composer require jshibu86/validator:^2.0
```

---

Usage
-----

[](#usage)

After Installed Follow the steps. ##Step1: Add the Service provider to app.php,

```
'providers' => [
    // Other providers...
    Shibu\ValidationGenerator\Services\ValidationGeneratorServiceProvider::class,
],
```

\##Step1: Use the service to the controller ,

```
use Shibu\ValidationGenerator\Services\ValidationGeneratorService;

class YourController extends Controller
{
    protected $validationService;

    public function __construct(ValidationGeneratorService $validationService)
    {
        $this->validationService = $validationService;
    }

    public function store(Request $request)
    {
        $tableName = 'students'; // Pass the table name dynamically or hardcoded
        $data = $request->all();

        $rules = $this->validationService->generateValidationRules($tableName);

        // Perform validation
        $validator = \Validator::make($data, $rules);

        if ($validator->fails()) {
            return response()->json($validator->errors(), 422);
        }

        // If validation passes, save the data
        // Example:
        // Student::create($data);

        return response()->json(['message' => 'Data saved successfully']);
    }
}
```

### Command(only for older versions : 1.0,1.0.0)

[](#commandonly-for-older-versions--10100)

```
php artisan validate-table {tableName}
```

Replace `{tableName}` with the name of the table you want to validate.

### Example (only for older versions : 1.0,1.0.0)

[](#example-only-for-older-versions--10100)

For a table named `users` with the following schema:

ColumnTypeNullableLengthExtraidBIGINTNO-Auto IncrementnameVARCHARNO255emailVARCHARYES255phoneVARCHARNO255noteTEXTYES-created\_atTIMESTAMPYES-updated\_atTIMESTAMPYES-Running the command:

```
php artisan validate-table users
```

Will output:

```
[
    'name' => ['required', 'string', 'max:255'],
    'email' => ['nullable', 'string', 'max:255'],
    'phone' => ['required', 'string', 'max:255'],
    'note' => ['nullable', 'string'],
]
```

---

Customization
-------------

[](#customization)

This package is designed to work out of the box, but you can extend or modify it if needed by publishing the config file.

```
php artisan vendor:publish
```

Select the `Provider: Schema\ValidationGenerator\ValidationGeneratorServiceProvider` option. Then edit the `resources/vendor/Schema-validation-generator/validationGeneratorConfig.json` to match your database's column types.

---

Contributing
------------

[](#contributing)

Contributions are welcome! Feel free to fork the repository and submit pull requests for improvements.

---

License
-------

[](#license)

This package is open-source and licensed under the [MIT License](https://opensource.org/licenses/MIT).

---

Support
-------

[](#support)

For issues or questions, please open an issue on the [GitHub repository](https://github.com/jshibu86/validator) .

---

Credits
-------

[](#credits)

Developed with ❤️

---

Let me know if you’d like to refine this further!

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance45

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~1 days

Total

2

Last Release

432d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/46942a31ec71a79ba9e5c7e7dea2cfb2e71b05d73848b90bb6a29fe481b869f5?d=identicon)[Shibu J](/maintainers/Shibu%20J)

---

Top Contributors

[![jshibu86](https://avatars.githubusercontent.com/u/147502312?v=4)](https://github.com/jshibu86 "jshibu86 (13 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jshibu86-validator/health.svg)

```
[![Health](https://phpackages.com/badges/jshibu86-validator/health.svg)](https://phpackages.com/packages/jshibu86-validator)
```

###  Alternatives

[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1036.7k3](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

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