1Yii::$app->db
2->createCommand()
3->batchInsert('table_name', ['column1','column2', 'column3','column4','column5'],$data)
4->execute();
1// It's usually much easier to use DAO instead of ActiveRecord
2
3// table name, column names, column values
4Yii::$app->db->createCommand()->batchInsert('users', ['name', 'age'], [
5 ['Tom', 30],
6 ['Jane', 20],
7 ['Linda', 25],
8])->execute();