PHPackages                             eksa-com/laravel-validation - 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. eksa-com/laravel-validation

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

eksa-com/laravel-validation
===========================

Laravel Validation Service

1.4(1y ago)0997↓100%1PHPPHP &gt;=5.4.0

Since Apr 22Pushed 1y agoCompare

[ Source](https://github.com/eksa-com/laravel-validator)[ Packagist](https://packagist.org/packages/eksa-com/laravel-validation)[ Docs](http://andersao.github.io/laravel-validation)[ RSS](/packages/eksa-com-laravel-validation/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (1)

Laravel Validation Service
==========================

[](#laravel-validation-service)

[![Total Downloads](https://camo.githubusercontent.com/0f252024417a63c2cb3d7952113ca6122f6eb30849d77a42b6d9671a7effefa6/68747470733a2f2f706f7365722e707567782e6f72672f707265747475732f6c61726176656c2d76616c69646174696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/prettus/laravel-validation)[![Latest Stable Version](https://camo.githubusercontent.com/5a58e04fc9e1c5329c8966d3a7aa64d1eb7891fab0c916800e41d27f5786812f/68747470733a2f2f706f7365722e707567782e6f72672f707265747475732f6c61726176656c2d76616c69646174696f6e2f762f737461626c652e737667)](https://packagist.org/packages/prettus/laravel-validation)[![Latest Unstable Version](https://camo.githubusercontent.com/ea4e13289509c7bab8ab905aeff89903dd344b7c41e8220ccda2d058bcba7c4f/68747470733a2f2f706f7365722e707567782e6f72672f707265747475732f6c61726176656c2d76616c69646174696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/prettus/laravel-validation)[![License](https://camo.githubusercontent.com/c47050b9e7e2815d29279f34b9dbb78a5c0e5365362cfb923389d7c1fba4b955/68747470733a2f2f706f7365722e707567782e6f72672f707265747475732f6c61726176656c2d76616c69646174696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/prettus/laravel-validation)

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

[](#installation)

Add "prettus/laravel-repository": "1.1.\*" to composer.json

```
"prettus/laravel-validation": "1.1.*"
```

### Create a validator

[](#create-a-validator)

The Validator contains rules for adding, editing.

```
Prettus\Validator\Contracts\ValidatorInterface::RULE_CREATE
Prettus\Validator\Contracts\ValidatorInterface::RULE_UPDATE
```

In the example below, we define some rules for both creation and edition

```
use \Prettus\Validator\LaravelValidator;

class PostValidator extends LaravelValidator {

    protected $rules = [
        'title' => 'required',
        'text'  => 'min:3',
        'author'=> 'required'
    ];

}
```

To define specific rules, proceed as shown below:

```
use \Prettus\Validator\LaravelValidator;

class PostValidator extends LaravelValidator {

    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'title' => 'required',
            'text'  => 'min:3',
            'author'=> 'required'
        ],
        ValidatorInterface::RULE_UPDATE => [
            'title' => 'required'
        ]
   ];

}
```

### Custom Error Messages

[](#custom-error-messages)

You may use custom error messages for validation instead of the defaults

```
protected $messages = [
    'required' => 'The :attribute field is required.',
];
```

Or, you may wish to specify a custom error messages only for a specific field.

```
protected $messages = [
    'email.required' => 'We need to know your e-mail address!',
];
```

### Custom Attributes

[](#custom-attributes)

You too may use custom name attributes

```
protected $attributes = [
    'email' => 'E-mail',
    'obs' => 'Observation',
];
```

### Using the Validator

[](#using-the-validator)

```
use \Prettus\Validator\Exceptions\ValidatorException;

class PostsController extends BaseController {

    /**
     * @var PostRepository
     */
    protected $repository;

    /**
     * @var PostValidator
     */
    protected $validator;

    public function __construct(PostRepository $repository, PostValidator $validator){
        $this->repository = $repository;
        $this->validator  = $validator;
    }

    public function store()
    {

        try {

            $this->validator->with( Input::all() )->passesOrFail();

            // OR $this->validator->with( Input::all() )->passesOrFail( ValidatorInterface::RULE_CREATE );

            $post = $this->repository->create( Input::all() );

            return Response::json([
                'message'=>'Post created',
                'data'   =>$post->toArray()
            ]);

        } catch (ValidatorException $e) {

            return Response::json([
                'error'   =>true,
                'message' =>$e->getMessage()
            ]);

        }
    }

    public function update($id)
    {

        try{

            $this->validator->with( Input::all() )->passesOrFail( ValidatorInterface::RULE_UPDATE );

            $post = $this->repository->update( Input::all(), $id );

            return Response::json([
                'message'=>'Post created',
                'data'   =>$post->toArray()
            ]);

        }catch (ValidatorException $e){

            return Response::json([
                'error'   =>true,
                'message' =>$e->getMessage()
            ]);

        }

    }
}
```

Author
======

[](#author)

Anderson Andrade -

Credits
-------

[](#credits)

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.1% 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

700d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5cf8c197e4a6a0867e082dc2c83b21112579709c592c1642b5657728f973561?d=identicon)[robertravnik](/maintainers/robertravnik)

---

Top Contributors

[![andersao](https://avatars.githubusercontent.com/u/1131667?v=4)](https://github.com/andersao "andersao (23 commits)")[![bsormagec](https://avatars.githubusercontent.com/u/965219?v=4)](https://github.com/bsormagec "bsormagec (4 commits)")[![jartaud](https://avatars.githubusercontent.com/u/266818?v=4)](https://github.com/jartaud "jartaud (3 commits)")[![mapb1990](https://avatars.githubusercontent.com/u/1731701?v=4)](https://github.com/mapb1990 "mapb1990 (2 commits)")[![moura137](https://avatars.githubusercontent.com/u/1171111?v=4)](https://github.com/moura137 "moura137 (2 commits)")[![robertravnik](https://avatars.githubusercontent.com/u/9676174?v=4)](https://github.com/robertravnik "robertravnik (1 commits)")[![acasey](https://avatars.githubusercontent.com/u/1518549?v=4)](https://github.com/acasey "acasey (1 commits)")[![samrook](https://avatars.githubusercontent.com/u/26875613?v=4)](https://github.com/samrook "samrook (1 commits)")[![djoeycl](https://avatars.githubusercontent.com/u/53512949?v=4)](https://github.com/djoeycl "djoeycl (1 commits)")[![henninghorn](https://avatars.githubusercontent.com/u/742607?v=4)](https://github.com/henninghorn "henninghorn (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (1 commits)")

---

Tags

laravelvalidationservice

### Embed Badge

![Health badge](/badges/eksa-com-laravel-validation/health.svg)

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

###  Alternatives

[prettus/laravel-validation

Laravel Validation Service

42310.6M41](/packages/prettus-laravel-validation)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3873.2M1](/packages/axlon-laravel-postal-code-validation)[timacdonald/rule-builder

A fluent rule builder for Laravel validation rule generation.

1017.6k](/packages/timacdonald-rule-builder)[skysplit/laravel5-intl-translation

Laravel 5 package for better translation syntax using php-intl extension

10106.2k](/packages/skysplit-laravel5-intl-translation)

PHPackages © 2026

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