You can use Yes It Batch Insert to insert multiple lines. This is faster than any of the methods described here:
$connection->createCommand()->batchInsert('table_name', ['table_column_1', 'table_column_2'], [ ['column_1_data_a', 'column_2_data_a'], ['column_1_data_b', 'column_2_data_b'], ['column_1_data_c', 'column_2_data_c'], ])->execute();
Mark the link for this .
source share