1. Go to this page and download the library: Download rikcage/yii2-import library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rikcage / yii2-import example snippets
class Post extends Model
{
const STATUS_NEW = 0;
const STATUS_APPROVED = 1;
public $title;
public $status;
public $content;
public static function getStatusList()
{
return [
self::STATUS_NEW = 'New',
self::STATUS_APPROVED = 'Approved',
];
}
}
class ImportForm extends Model
{
public $file;
public function rules()
{
return [
['file', 'file', 'skipOnEmpty' => false, 'extensions' => 'xlsx'],
];
}
}