samdark/yii2-minimal

Yii 2 最小化应用模板

支持包维护!
samdark
Patreon

安装量: 3,222

依赖项: 0

建议者: 0

安全性: 0

星标: 140

关注者: 11

分支: 33

公开问题: 0

类型:项目

2.0.5 2021-11-19 21:34 UTC

This package is auto-updated.

Last update: 2024-09-20 04:20:33 UTC


README

Yii 2 最小化应用模板是一个最佳的从零开始构建的框架模板。

模板包含基本功能,包括用户登录/注销。它包含了所有常用的配置,以便您能集中精力添加新功能到您的应用中。

目录结构

  commands/           contains console commands (controllers)
  config/             contains application configurations
  controllers/        contains Web controller classes
  models/             contains model classes
  runtime/            contains files generated during runtime
  vendor/             contains dependent 3rd-party packages
  views/              contains view files for the Web application
  web/                contains the entry script and Web resources

需求

本应用模板的最低要求是您的 Web 服务器支持 PHP 5.4.0。

安装

如果您没有 Composer,您可以通过在 getcomposer.org 上找到的说明进行安装。

然后您可以使用以下命令安装此应用模板

composer create-project --prefer-dist --stability=dev samdark/yii2-minimal path/to/your/project

现在您应该可以通过以下 URL 访问应用,假设您的服务器 webroot 指向 project/web 目录。

https://127.0.0.1/

配置

数据库

编辑文件 config/db.php 使用实际数据,例如

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2minimal',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];

备注

  • Yii 不会为您创建数据库,这需要在您访问它之前手动完成。
  • 检查并编辑 config/ 目录中的其他文件以根据需要自定义您的应用。