PHPackages                             hesami/laravel-json-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. hesami/laravel-json-validator

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

hesami/laravel-json-validator
=============================

A package for validating JSON data in Laravel

v1.2.0(3y ago)219MITPHP

Since Feb 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hesami/laravel-json-validator)[ Packagist](https://packagist.org/packages/hesami/laravel-json-validator)[ RSS](/packages/hesami-laravel-json-validator/feed)WikiDiscussions master Synced today

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Json Validator For Laravel
==========================

[](#json-validator-for-laravel)

A package for validating JSON data in Laravel

I developed this package to teach programming concepts to my students in the classroom. But I think it will be useful for you too

I hope I can expand it.😊

If you like to develop it, it will definitely be useful for other programmers, especially beginners.

Requirement
===========

[](#requirement)

- Laravel 6, 7, 8, 9
- PHP 7.4 , 8

Installation:
=============

[](#installation)

```
composer require hesami/laravel-json-validator

```

How To use:
===========

[](#how-to-use)

RuleDescription`json_object`To check that the input data is a Json string and contains an object`json_array`To check that the input data is a Json string and contains an array`json_object_has_key`To check that the input is a Json string and contains an array whose items have a key or keys`json_array_items_has_key`To check that the input is a Json string and contains an array whose items have a key or keys`json_array_items_numeric`Checks that the elements of the array are of numeric type.`json_array_items_distinct`To check that the input data is a Json string and contains an distinct array`json_array_items_count`To check that the input data is a Json string and contains an array that has a certain number (10 or ...) of objects`json_array_items_min`To check that the input data is a Json string and contains an array containing at least $min objects`json_array_items_max`To check that the input data is a Json string and contains an array that has at most :max objectsTo check that the input data is a Json string and contains an object:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_object']
]);
```

To check that the input data is a Json string and contains an array:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array']
]);
```

To check that the input data is a Json string and contains an object that has a key or keys:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_object', 'json_object_has_key:title,desc']
]);
```

To check that the input is a Json string and contains an array whose items have a key or keys:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_has_key:title,desc']
]);
```

Checks that the elements of the array are of numeric type:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_numeric']
]);
```

To check that the input data is a Json string and contains an distinct array:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', 'json_array_items_has_key:name', "json_array_items_distinct:name"]
]);
```

To check that the input data is a Json string and contains an array that has a certain number (10 or ...) of objects:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_count:$count"]
]);
```

To check that the input data is a Json string and contains an array containing at least $min objects:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_min:$min"]
]);
```

To check that the input data is a Json string and contains an array that has at most :max objects:

```
Validator::make($request->all(), [
    'movies' => ['json', 'json_array', "json_array_items_max:$max"]
]);
```

Attention:
==========

[](#attention)

To customize the text of the messages in this version, you need to manually write the message validation language in the file.

```
lng->en->validation.php
```

License
=======

[](#license)

The MIT license ([MIT](https://github.com/hesami/laravel-json-validator/blob/master/LICENSE.md)).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~4 days

Total

4

Last Release

1230d ago

Major Versions

v0.1.0-alpha → v1.0.02023-02-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a1f778c31b6d679994d9cf54afad15619398102a298f36d88308236ba04556a?d=identicon)[hesami](/maintainers/hesami)

---

Top Contributors

[![hesami](https://avatars.githubusercontent.com/u/17120377?v=4)](https://github.com/hesami "hesami (16 commits)")

---

Tags

laravelvalidatorjson-validator

### Embed Badge

![Health badge](/badges/hesami-laravel-json-validator/health.svg)

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

###  Alternatives

[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

183530.2k](/packages/illuminatech-validation-composite)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69370.9k](/packages/laravel-validation-rules-phone)[laravel-validation-rules/us-state

Validate US States and Canada Provinces

16181.0k](/packages/laravel-validation-rules-us-state)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.9k](/packages/stuyam-laravel-phone-validator)[laravel-validation-rules/timezone

Validate that a given timezone is valid.

2119.0k](/packages/laravel-validation-rules-timezone)

PHPackages © 2026

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