Yii2 Insert Query

save() OR insert()

$model = new User;
$model->name = 'YII';
$model->email = 'yii2@framework.com';
$model->save();  // equivalent to $model->insert();

insert() command

$connection->createCommand()
	->insert('tbl_user', [
			'name' => 'yii',
			'status' => 1,])
	->execute();

batchInsert()

Insert multiple rows at once using batchInsert() function.

$connection	->createCommand()
			->batchInsert('tbl_user', ['name', 'status'], 
			[
				['Bala', 1],
				['Akilan', 0],
				['Babu', 1],
			])
			->execute();