PHP code example of hantless / simple-vat

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

    

hantless / simple-vat example snippets



/**
 * Get the validation rules that apply to the request.
 *
 * @return array
*/
public function rules()
{
    return [
        'vatnumberfield' => 'vat_format',
    ];
}



 public function store(Request $request)
{
    $validator = Validator::make($request->all(), [
        'vatnumberfield' => 'vat_format',
    ]);

    if ($validator->fails()) {
        // redirect ... display error
    }
    
    // store entity...
}



'vat_format' => 'The :attribute do not seem to be a valid VAT number',