1. Go to this page and download the library: Download umono/yaa-yii2 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/ */
umono / yaa-yii2 example snippets
namespace app\modules\backend\api\controllers;
use app\modules\backend\api\Controller;
use app\modules\backend\api\models\other\User;
class UserController extends Controller
{
// 数据列表
public function actionIndex()
{
$get = $this->get;
$andWhere = [
['like', 'nickName', $get['nickName'] ?? ''],
['like', 'name', $get['name'] ?? ''],
['like', 'phone', $get['phone'] ?? ''],
];
return User::page()->andWhere($andWhere)->toTableDataArray();
}
// 创建、修改、删除
// ...
}
shell
composer create-project umono/yaa-yii2
cd yaa-yii2 && php yii init
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.