This package adds a CSV validator to your Laravel project. This validator parses uploaded file using parsecsv/php-parsecsv library and validation is passed when there are no errors during parsing.
This package doesn't validate against a MIME type or file extension.
You can install package via composer:
composer require minuteoflaravel/laravel-csv-validator
Check if a file has a CSV format:
$request->validate([
'uploaded_file' => 'csv',
]);
If you need to add your custom translatable error message then just add it as always to resources/lang/en/validation.php file:
'csv' => 'The :attribute must be a CSV file.',
The MIT License (MIT). Please see License File for more information.