PHP code example of laasti / valitron-provider

1. Go to this page and download the library: Download laasti/valitron-provider library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laasti / valitron-provider example snippets



$container = new League\Container\Container;
$container->add('config', [
    'valitron' =>[
        'locale' => 'fr',//if not specified, attempts to use config.locale in the container, defaults to en,
        'locales_dir' => __DIR__,//defaults, to Valitron's language files directory
        //Additional rules to add to Valitron, any php callbacks are accepted
        'rules' => [
            ['my_rule', 'my_callback', 'My message']
        ]
    ]
]);
$container->addServiceProvider('Laasti\ValitronProvider\ValitronProvider');

//The arguments are the same as Valitron's constructor
$validator = $container->get('Valitron\Validator', [$data]);