PHP code example of ciricihq / localized

1. Go to this page and download the library: Download ciricihq/localized 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/ */

    

ciricihq / localized example snippets


namespace App\Model\Table;

use Cake\ORM\Table;
use Cake\Localized\Validation\FrValidation
use Cake\Validation\Validator;

class PostsTable extends Table
{
    public function validationDefault(Validator $validator)
    {
        $validator->provider('fr', FrValidation::class);
        $validator->add('phoneField', 'myCustomRuleNameForPhone', [
            'rule' => 'phone',
            'provider' => 'fr'
        ]);
    }
}