1, 'username' => 'lodev09', 'email' => 'lodev09@gmail.com'], ['id' => 2, 'username' => 'sunny', 'email' => 'sunny@gotbootstrap.com'], ['id' => 3, 'username' => 'jos', 'email' => 'jos@email.com'], ['id' => 4, 'username' => 'roberto', 'email' => 'roberto@email.com'] ]; $file_upload = false; if (!empty($_FILES['file'])) { try { $upload = new \Upload\Upload($_FILES['file']); if ($upload->file) { $token = hash('sha256', token().'_'.$upload->file->name); $tmp_filename = $token.$upload->file->extension; $file_path = APP_TMP_PATH.'/'.$tmp_filename; $upload->file->put($file_path); $reader = new \Common\DataReader($file_path); $data = $reader->read(); $file_upload = true; } } catch (Exception $ex) { $exception = $ex->getMessage(); } } $config = [ 'bordered' => 'Bordered Table', 'small' => 'Smaller Table', 'dark' => 'Table Dark', 'light' => 'Table Light', 'hover' => 'Table Hover', 'striped' => 'Table Striped' ]; if ($_POST) { foreach (array_keys($config) as $name) { $value = get($name, $_POST); $options[$name] = $value ? true : false; } } else { $options = ['bordered' => true, 'striped' => true]; } $table = new \Bootstrap\Components\Table($data, $options); if (!$file_upload) { $table->col = [ 'id' => '#', 'username' => 'Username', 'email' => 'Email' ]; $table->cell = [ 'username' => function ($row, $value) use ($options) { return '@'.$value.''; } ]; } ?>