Download the PHP package bllim/laravel-to-jquery-validation without Composer

On this page you can find all versions of the php package bllim/laravel-to-jquery-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-to-jquery-validation

This package is no more maintained.

Look Laravalid for same function and more features:


Laravel to Jquery Validation

About

This package makes validation rules defined in laravel work client-side by converting to jquery validation rules. It uses Jquery Validation Plugin. It also allows to use laravel validation messages so you can show same messages for both sides.

Feature Overview

Installation

Require bllim/laravel-to-jquery-validation in composer.json and run composer update.

{
    "require": {
        "laravel/framework": "4.0.*",
        ...
        "bllim/laravel-to-jquery-validation": "*"
    }
    ...
}

Composer will download the package. After the package is downloaded, open app/config/app.php and add the service provider and alias as below:

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

Usage

Since the package uses Jquery Validation Plugin you should include it in (and include jquery of course) your views. Also for unsupported rules in jquery validator, you should include jquery.validate.laravel.js in your views, too. After assets published, they will be copied to your public folder. The last thing you should do at client side is initializing jquery validator plugin as below:

The package uses laravel Form Builder to make validation rules work for both sides. Therefore you should use Form Builder. While opening form by using Form::open you can give $rules as second parameter:

Also if you don't want to struggle with $rules at view files, you can set it in Controller or route by using Form::setValidation . This sets rules for first Form::open

For rules which is related to input type in laravel (such as max, min), the package looks for other given rules to understand which type is input. If you give integer or numeric as rule with max, min rules, the package assume input is numeric and convert to data-rule-max instead of data-rule-maxlength.

The converter assume input is string by default. File type is not supported yet.

Validation Messages

Converter uses validation messages of laravel (app/lang/en/validation.php) by default for client-side too. If you want to use jquery validation messages, you can set useLaravelMessages, false in config file of package which you copied to your config dir. By default, it is true.

Example

Controller/Route side

View side

Supported validation rules

Contribute

You can fork and contribute to development of the package. All pull requests is welcome.

Setting New Convertion Rule

The package, converts rules by using defined methods which is named like _convertRuleRuleName and converts messages by using defined methods which is named like _convertMessageRuleName. You can add new methods to convert current rules and messages. You don't have to add method for converting messages if it is working well without adding. There is getErrorMessage method to handle error messages (which contains just :attribute parameter) by default.

Both rule and message converter method take 3 parameters which are:

$parsedRule: ['name' => '', 'parameters' => []] formatted array which gives name and parameters of the rule,
$attribute: attribute name of the input, 
$type: type of the current input. by default it is string, if rules of an input contains numeric or integer, it is set numeric.

Both rule and message converter returns attributes for the current input. For example if you are converting required rule, you should add input tag by returning

You can look at existed methods to understand how it works.

Known issues

TODO

License

Licensed under the MIT License


All versions of laravel-to-jquery-validation with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/html Version >=4.2
illuminate/support Version >=4.2
illuminate/validation Version >=4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bllim/laravel-to-jquery-validation contains the following files

Loading the files please wait ....