dektrium/yii2-app-skeleton
Composer 安装命令:
composer create-project dektrium/yii2-app-skeleton
包简介
Yii2 application template
README 文档
README
Yii2-app-skeleton is an Yii2 application template with minimum requirements and dependencies.
Features
- Uses Asset-packagist instead of fxp/composer-asset-plugin to install bower and npm packages.
- Uses PHP dotenv for handling configuration
- Init command which creates needed directories and warms up dotenv config
- Preconfigured multiple cache and session backends which can be switched easily
- No junk you need to remove every time you start (e.g. contact or registration forms as in yiisoft/yii2-app-basic)
Requirements
The minimum requirement by this project template that your Web server supports PHP 5.4.0.
Installation
composer create-project dektrium/yii2-app-skeleton
That's all. After project is created, composer will run php yii init, which will create needed directories and config
files. However when you deploy your project to server (or download it using git or zip archive), you will need to run
following commands:
php yii init
# Run following if you are on production
php yii init/env prod
Overview
Top level directories
commands
The commands directory contains your console application's controllers (commands).
config
The config directory contains all of your application's configuration files.
controllers
The controllers directory contains your web application's controllers.
The mail directory contains your application's mail view files.
migrations
The migrations directory contains database migration files.
runtime
The runtime directory contains application logs, cache and debug information.
vendor
The vendor directory contains your Composer dependencies.
views
The views directory containes your application's view files.
web
THe web directory contains the index.php file, which is the entry point for all requests entering your application.
Configuration
All of the configuration files are stored in the config directory.
Environment configuration
It is often helpful to have different configuration values based on the environment the application is running in. For example, you may wish to use a different cache driver locally than you do on your production server.
To solve this problem Yii2-app-skeleton uses PHP dotenv. After installation
you will find file called .env.example in your config directory. If you install Yii2-app-skeleton via Composer,
this file will automatically be renamed to .env. Otherwise, you need to run initialize command.
All of the variables in this file will be loaded into $_ENV PHP super global. You can retrieve them by using env
function which is declared inside config/helpers.php file. If you look closer at configuration files in config
directory you will see how often function env is used.
Your .env file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration.
You may want to add custom variables to .env.example file. After you do that, you can run php yii init command
and they will be automatically injected in .env file.
Changing application environment
Out of the box Yii2-app-skeleton comes with enabled YII_DEBUG and with YII_ENV="dev". You should change it when deploying your app to production servers (or sometimes you may need it to be done locally on your machine). To do it you can use init/env command:
php yii init/env prod
# Or if you want to change to dev environment:
php yii init/env dev
What's next?
Check out following links:
- The Definitive Guide to Yii 2.0
- Yii2 cookbook by SamDark
IDE tweaks
dektrium/yii2-app-skeleton 适用场景与选型建议
dektrium/yii2-app-skeleton 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 123 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「application template」 「yii2」 「dektrium」 「yii2-application-template」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dektrium/yii2-app-skeleton 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dektrium/yii2-app-skeleton 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dektrium/yii2-app-skeleton 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kinikit - PHP Application development framework MVC component
A custom URL rule class for Yii 2 which allows to create translated URL rules
A Laravel queue connector to process jobs at the end of the application
C3JS By phpanonymous (Mahmoud Ibrahim)
Simple ASCII output of array data
E2E Studios PHP Framework adaptation of leafsphp/blade package
统计信息
- 总下载量: 123
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-03