Yii 2 GridView
Using ArrayDataProvider

In controller:

function actionIndex()
{
  // Array example 1
  $some_array[] = [
    'id'    => 1,
    'name'  => 'mark',
    'email' => 'joe@example.com'
  ];
 
  // Array example 2
  $query = new Query;
  $some_array[] = $query->from('user')->all();
 
  // Assign array to DataProvider
  $provider = new \yii\data\ArrayDataProvider([
    'allModels' => $some_array,
    'sort' => [
        'attributes' => ['id', 'name', 'email'],
    ],
    'pagination' => [
        'pageSize' => 20,
    ],
  ]);
 
  //...
  return $this->render('index', [
      'dataProvider'=> $provider,
      //...
  ]);
}  

In view:

<?= yii\grid\GridView::widget([
      'dataProvider' => $dataProvider,
      'filterModel'  => $searchModel,
      'columns' => [ 
         //...
      ],
  ])
?>