PDO::ERRMODE_EXCEPTION, )); $pdo->query('CREATE TABLE IF NOT EXISTS user (id INT, `name` VARCHAR(255), email VARCHAR(255))'); // Importing $config = new LexerConfig(); $lexer = new Lexer($config); $interpreter = new Interpreter(); $interpreter->addObserver(function(array $columns) use ($pdo) { $stmt = $pdo->prepare('INSERT INTO user (id, name, email) VALUES (?, ?, ?)'); $stmt->execute($columns); }); $lexer->parse('user.csv', $interpreter); // Exporting $config = new ExporterConfig(); $exporter = new Exporter($config); $exporter->export('php://output', array( array('1', 'alice', 'alice@example.com'), array('2', 'bob', 'bob@example.com'), array('3', 'carol', 'carol@example.com'), ));