title: Lumen: Is there any package to import CSV data to database?
body: <p>I have written following code to import CSV data in the database:</p>
  <pre><code>if(($request-&gt;file(&quot;csv&quot;) !== null)){
              $filename=$_FILES[&quot;csv&quot;][&quot;tmp_name&quot;];
               if($_FILES[&quot;csv&quot;][&quot;size&quot;] &gt; 0)
               {
                  $file = fopen($filename, &quot;r&quot;);
                    while (($getData = fgetcsv($file, 10000, &quot;,&quot;)) !== FALSE)
                     {
                      DB::table('users')-&gt;updateOrInsert(
                          ['email' =&gt; $getData[1]],
                          ['name' =&gt; @$getData[0], 'phone' =&gt; @$getData[2], 'address'=&gt; @$getData[3]]
                      );
                     }
                     fclose($file);
               }
            }
  </code></pre>
  <p>But it gives the following error when it reaches to insertion:</p>
  <blockquote>
  <p>SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE0\xA5\xC7\x9EDO...' for column 'email' at row 1 (SQL: insert into <code>users</code> (<code>email</code>, <code>name</code>, <code>phone</code>, <code>address</code>) values (�ǞDO97*�~��ɸ8�O�c|n���E�</p>
  </blockquote>
  <p>Why am I getting this error? Is there any Lumen package to import CSV to database which has proper documentation?</p>