hazzard/validation
Use Illuminate Validation outside Laravel.
389
2
| Install | |
|---|---|
composer require hazzard/validation |
|
| Latest Version: | 1.0.1 |
| PHP: | >=5.4 |
| Laravel: | 5 |
| Older releases: | 4 |
| License: | MIT |
| Last Updated: | Oct 20, 2017 |
| Links: | GitHub · Packagist |
Maintainer: cretueusebiu
Illuminate Validation Outside Laravel
Installation
composer require illuminate/validation
composer require hazzard/validation
Usage
use Hazzard\Validation\Validator;
$validator = new Validator;
// Set default language lines used by the translator.
$validator->setDefaultLines();
// Make instance available globally via static methods (optional).
$validator->setAsGlobal();
// Create a class alias (optional).
$validator->classAlias();
Database Presence Verifier
Using the Illuminate Database Capsule set the database connection instance:
$db = $capsule->getDatabaseManager();
$validator->setConnection($db);
Providing A Custom Translator
To provide a custom translator pass an instance of Illuminate\Container\Container with the translator bound to translator.
The translator must implement Symfony\Component\Translation\TranslatorInterface.
$container['translator'] = new CustomTranslator();
$validator = new Validator($container);
Using The Validator
$validator = Validator::make(
['name' => 'Dayle'],
['name' => 'required|min:5']
);
The rest is the same as Laravel.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
651,963,193
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
435,097,283
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
407,699,310
4,663
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.1 | >=5.4 | 5.0.*| | MIT | |
| 1.0.0 | >=5.4 | 5.0.*| | MIT | |
| 0.2.0 | >=5.3.0 | 4.1.*| | MIT | |
| 0.1.0 | >=5.3.0 | 4.1.* | MIT |