PHPackages                             laravel-ardent/laravalid - 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. laravel-ardent/laravalid

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

laravel-ardent/laravalid
========================

Integrates Ardent models validation rules into Laravel forms

v2.3.3(10y ago)3137[1 PRs](https://github.com/laravel-ardent/laravalid/pulls)MITPHP

Since Mar 16Pushed 10y ago2 watchersCompare

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

READMEChangelog (4)Dependencies (5)Versions (21)Used By (0)

\#Laravalid + Ardent

#### Laravel Validation For Client Side, using self-validating smart models from Ardent

[](#laravel-validation-for-client-side-using-self-validating-smart-models-from-ardent)

This package makes validation rules defined in Laravel work in the client by converting validation rules to HTML + JS plugins (such as jQuery Validation). It also allows you to use Laravel validation messages so you can show the same messages on both sides.

### Table of contents

[](#table-of-contents)

- [Feature Overview](#feature-overview)
- [Installation](#installation)
- [Configuration](#configuration)
    - [Validation messages](#validation-messages)
- [Usage](#usage)
    - [With Ardent](#usage-with-ardent)
- [Extending](#extending)
- [Plugins and Supported Rules](#plugins-and-supported-rules)
- [Known Issues](#known-issues)
- [To Do](#todo)
- [Changelog](#changelog)
- [Licence](#licence)

### Feature Overview

[](#feature-overview)

- Multi-Plugin Support *(For now, there is just one :)*
    - `jQuery Validation`
- Extensible
- Laravel form builder based
- Validation rules can be set from controller
- Distinguishing between numeric input and string input
- User-friendly input names
- Remote rules such as unique and exists

### Installation

[](#installation)

Require `bllim/laravel-validation-for-client-side` in composer.json and run `composer update`.

```
{
    "require": {
        "laravel/framework": "5.1.*",
        ...
        "laravel-ardent/laravalid": "2.*"
    }
    ...
}

```

> **Note:** For **Laravel 4** use `laravel4` branch: `"laravel-ardent/laravalid": "dev-laravel4"`

Composer will download the package. After that, open `config/app.php` and add the service provider and aliases:

```
    'providers' => [
        ...
        'LaravelArdent\Laravalid\LaravalidServiceProvider',
    ],

    'aliases' => [
        ...
        'HTML' => 'Illuminate\Support\Facades\HTML',
        'Form' => 'LaravelArdent\Laravalid\Facade',
    ],
```

Also you need to publish configuration file and assets by running the following Artisan commands.

```
$ ./artisan vendor:publish
```

### Configuration

[](#configuration)

After publishing configuration file, you can find it in config/laravalid folder. Configuration parameters are as below:

ParameterDescriptionValuespluginChoose plugin you want to useSee [Plugins and Supported Rules](#plugins-and-supported-rules)useLaravelMessagesIf it is true, laravel validation messages are used in client side otherwise messages of chosen plugin are used`boolean`. See [Validation Messages](#validation-messages)routeRoute name for remote validationAny route name (default: laravalid). The route will receive an argument named `rule`actionA custom action to run the remote validation procedureAn action string, such as `SiteController@getValidation` (watch out for route conflicts, this will be added after your `routes.php` file is processed). This is needed if you want to cache routes (`./artisan route:cache`). If you include this, for the default behaviour you can return from your method `app('laravalid')->remoteValidation($rule)`.#### Validation Messages

[](#validation-messages)

If you set `useLaravelMessages` to `true`, you're able to use (Laravel's Localization package)[l10n](http://laravel.com/docs/5.1/localizationl) to generate validation messages. To do so, follow the [docs](http://laravel.com/docs/5.1/localizationl) to get the package configured (by setting your default/fallback/current locales). Then, create a folder for each locale (as the docs says) and create a `validation.php` file for each one. Inside those files you'll set a message for each rule name, as follows:

```
