Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/inc/csv.php b/src/inc/csv.php
new file mode 100644
index 0000000..ce44c81
--- /dev/null
+++ b/src/inc/csv.php
@@ -0,0 +1,31 @@
+<?php
+class csv {
+  public static $fields = ["dni", "name", "category", "email", "companies"];
+
+  public static function csv2array($filename) {
+    $file = fopen($filename, "r");
+
+    $return = [];
+
+    $i = 0;
+    while (($line = fgetcsv($file, null, ";")) !== false) {
+      if ($i == 0) {
+        if (count($line) < count(self::$fields)) return false;
+
+        for ($j = 0; $j < count(self::$fields); $j++) {
+          if ($line[$j] !== self::$fields[$j]) return false;
+        }
+      } else {
+        $return[$i] = [];
+        foreach (self::$fields as $j => $field) {
+          $return[$i][$field] = trim($line[$j]);
+        }
+      }
+      $i++;
+    }
+
+    fclose($file);
+
+    return $return;
+  }
+}