docker-compose build nginx php-fpm mysql workspace # притягивание и сборка контейнеров
docker-compose up -d nginx php-fpm mysql workspace # запуск созданных контейнеров
docker-compose exec workspace bash # запуск коммандной строки в контейнере
su laradock
mkdir ${PROJ} && cd ${PROJ} && composer create-project --prefer-dist yiisoft/yii2-app-advanced .
files:
${PROJ}/common/config/main-local.php
${PROJ}/environments/dev/common/config/main-local.php
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=mysql;port=3306;dbname=database',
'username' => 'dbuser',
'password' => 'dbpasswd',
'charset' => 'utf8',
],
yii migrate/create table_name # create migration
yii migrate/to m190523_222637_table_name # apply migration by it's name
yii migrate/down 1
./yii gii/model --generateLabelsFromComments=1 --tableName=${table_name} --modelClass=${Classname} --ns='common\models'
server {
listen 80;
listen [::]:80;
server_name ${PROJ}.local;
root /var/www/${PROJ}/frontend/web;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
error_log /var/log/nginx/app_error.log;
access_log /var/log/nginx/app_access.log;
}
server {
listen 80;
listen [::]:80;
server_name admin.${PROJ}.local;
root /var/www/${PROJ}/backend/web;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
error_log /var/log/nginx/app_error.log;
access_log /var/log/nginx/app_access.log;
}
Yii 2 Advanced Project Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.
The template includes three tiers: front end, back end, and console, each of which is a separate Yii application.
The template is designed to work in a team development environment. It supports deploying the application in different environments.
Documentation is at docs/guide/README.md.
common
config/ contains shared configurations
mail/ contains view files for e-mails
models/ contains model classes used in both backend and frontend
tests/ contains tests for common classes
console
config/ contains console configurations
controllers/ contains console controllers (commands)
migrations/ contains database migrations
models/ contains console-specific model classes
runtime/ contains files generated during runtime
backend
assets/ contains application assets such as JavaScript and CSS
config/ contains backend configurations
controllers/ contains Web controller classes
models/ contains backend-specific model classes
runtime/ contains files generated during runtime
tests/ contains tests for backend application
views/ contains view files for the Web application
web/ contains the entry script and Web resources
frontend
assets/ contains application assets such as JavaScript and CSS
config/ contains frontend configurations
controllers/ contains Web controller classes
models/ contains frontend-specific model classes
runtime/ contains files generated during runtime
tests/ contains tests for frontend application
views/ contains view files for the Web application
web/ contains the entry script and Web resources
widgets/ contains frontend widgets
vendor/ contains dependent 3rd-party packages
environments/ contains environment-based overrides