Looking to hire Laravel developers? Try LaraJobs

laravel-csv-validator maintained by minuteoflaravel

Description
Adds CSV validator to your Laravel project
Last update
2024/04/22 21:46 (dev-main)
License
Downloads
11 641

Comments
comments powered by Disqus

Laravel CSV Validator

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.

Installation

You can install package via composer:

composer require minuteoflaravel/laravel-csv-validator

Example

Check if a file has a CSV format:

$request->validate([
    'uploaded_file' => 'csv',
]);

Custom error messages

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.',

License

The MIT License (MIT). Please see License File for more information.