PHP code example of aliportfolio / csv-importer
1. Go to this page and download the library: Download aliportfolio/csv-importer 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/ */
aliportfolio / csv-importer example snippets
namespace App\Imports;
use Aliportfolio\CsvImporter\CsvImporter;
class CategoryImport extends CsvImporter
{
// Model Name
protected $table = 'Category';
protected $mapping = [
'name' => 'name'
];
// Validation Data
protected $rules = [
'name' => '
$import = new CategoryImport();
$import->import($request->file('csv_file'));