Description of Yii2.x app initialization tool
This tool is an official tool, but it has been adjusted according to the [LNMP] Yii 2.x application directory structure (based on the official Advanced version). Therefore, you must follow the directory specifications when using this tool.
Function
- Application running environment check
- Composer tool, the library code file is in/../verdor/
- Quick application initialization, including index file deployment in the web Directory, directory read/write permission settings, file read/write file settings, configuration file initialization settings, and file soft chain settings
- Switch the running mode of the application, including the development mode and production mode (configurable and scalable)
- Deployment of other template files in different modes (for example, files such as robots.txt)
Tool structure
Requirements. php runtime environment check tool (web tool) composer. phar composer run the script composer. json composer code source configuration composer. lock composer lock file init initialization tool script init. bat initialization tool script (window) environments/application template file
Environments/
Index. php
Return [// Development mode 'development' => [// template code directory 'path' => 'dev ', // Set the readable directory 'setwritable' => ['backend/assets', 'frontend/assets', 'runtime', 'data',], // Set the executable file 'setexecutable' => ['console/yii', 'console/yii. bat ', 'tests/codeception/bin/yii',], // Set the cookie key 'setcookievalidationkey' => ['config/backend/main. php', 'config/frontend/main. php ',], // Soft link settings 'createsymline' => ['index. php '=>' frontend/index. php', 'index-test. php '=> 'frontend/index-test.php', 'robots' => 'frontend/robots', 'assets' => 'frontend/assets ', '/frontend/data' =>'/data', '/frontend/static' => '/static', '/backend/data' =>'/data ', '/backend/static' => '/static',], // The directory to be cleared before running 'setcleanpath' => ['frontend', 'backend',], // the user running the web program 'webuser' => 'nobody',],];
Dev
Template files in development mode
config/console/frontend/backend/
Prod
Template files in production mode
config/console/frontend/backend/
Tool running Configuration before running
Set the file to executable:
cd /path/tools/chmod u+x init composer.phar
Configure the actual path of the php command: starting with the init file
#! /Usr/local/php5.6.15/bin/php
Use the composer toolcd /path/tools/./composer.phar
Environment check toolsHttp://xxx.xxx.xxx/tools/requirements.php
Initialization toolcd /path/tools/./init
Running effect
Environment check (Yii 2.x)
Result of successful check
Initialization tool
Run