From 89282babc820ed4f0ed570dedf1b895bd07672ac Mon Sep 17 00:00:00 2001 From: Kilderson Sena Date: Thu, 3 Mar 2022 17:24:43 -0300 Subject: [PATCH] env adjustments and readme updates --- .env.sample | 3 ++- README.md | 43 +++++++++++++++++++++++++++---------------- codeception.yml | 36 ------------------------------------ composer.json | 4 +--- composer.lock | 39 ++++++++++++++++++++------------------- config/web.php | 3 +++ 6 files changed, 53 insertions(+), 75 deletions(-) delete mode 100644 codeception.yml diff --git a/.env.sample b/.env.sample index 64cba2c..8218c12 100644 --- a/.env.sample +++ b/.env.sample @@ -14,7 +14,8 @@ YII_ENV=dev YII_DEBUG=true REQUEST_COOKIE_VALIDATION_KEY=YOUR_VALIDATION_KEY ADMIN_PASSWORD= -APP_TIMEZONE=America/Sao_Paulo +# APP_TIMEZONE=America/Sao_Paulo +# APP_LANGUAGE=pt_BR APP_BASE_URL=http://localhost:8088 # --------- diff --git a/README.md b/README.md index d011476..3a8d34c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,16 @@ The motivation to make this new template was to try to organize the packages ins REQUIREMENTS ------------ -The minimum requirement by this project template that your Web server supports PHP 7+. +The minimum requirement by this project template that your Web server supports PHP 8+. + +RESOURCES +------------ + +- Nginx + PHP 8.1 with Docker using [Webdevops Images](https://github.com/webdevops/Dockerfile) +- PHP Unit 9.5 +- Yii2 Bootstrap 5 Extension +- PHP Codesniffer 3.5 +- PHP Codesniffer Fixer 3 INSTALLATION ------------ @@ -36,48 +45,48 @@ Make a copy of the `.env.sample` file, you can use `cp .env.sample .env` in your You can place your environment settings in `.env` file, as below (note the sample file is ready to basic usage): ```bash -# --------- -# Project -# --------- -PROJECT_NAME=yii2-skeleton - # --------- # Docker # --------- +PROJECT_NAME=yii2-skeleton DOCKER_APP_PORT=8080 +DOCKER_APP_SSL_PORT=443 DOCKER_MYSQL_PORT=3306 XDEBUG_REMOTE_PORT=9000 -XDEBUG_REMOTE_HOST=host.docker.internal # --------- -# Yii Framework +# Application # --------- -YII_DEBUG=true YII_ENV=dev +YII_DEBUG=true REQUEST_COOKIE_VALIDATION_KEY=YOUR_VALIDATION_KEY +ADMIN_PASSWORD= +# APP_TIMEZONE=America/Sao_Paulo +# APP_LANGUAGE=pt_BR +APP_BASE_URL=http://localhost:8088 # --------- # Database # --------- -DB_DSN=mysql:host=your-db-host;dbname=yii2_skeleton +DB_HOST=your-db-host DB_USERNAME=root DB_PASSWORD=secret -DB_DATABASE=yii2_skeleton -DB_CHARSET=utf8 -DB_ENABLE_SCHEMA_CACHE=false +DB_DATABASE=your-db-name +DB_DATABASE_TEST=your-test-db-name DB_SCHEMA_CACHE_DURATION=60 -DB_SCHEMA_CACHE_NAME=cache # --------- # Mailer # --------- SMTP_HOST= -SMTP_PORT= +SMTP_PORT=465 SMTP_USERNAME= SMTP_PASSWORD= -SMTP_ENCRYPTION= +SMTP_ENCRYPTION=ssl ``` +**NOTE:** the commented environment variables are optional and your values set here is its default value. + ### Run your Application Before anything change `PROJECT_NAME` env variable to your project name/alias. This one it will be used to prefixed the application containers and other stuff. @@ -88,6 +97,8 @@ To start your application and start up your containers just run the follow comma make run ``` +The command above will start 2 docker containers: `yii2-skeleton-app` (Nginx + PHP 8.1) and `yii2-skeleton-db` (MySQL) + If you have set a `DOCKER_APP_PORT` environment variable to `8000`, you will can then access the yout application through the following URL: ``` diff --git a/codeception.yml b/codeception.yml deleted file mode 100644 index a95affe..0000000 --- a/codeception.yml +++ /dev/null @@ -1,36 +0,0 @@ -actor: Tester -paths: - tests: tests - log: tests/_output - data: tests/_data - helpers: tests/_support -settings: - bootstrap: _bootstrap.php - memory_limit: 1024M - colors: true -modules: - config: - Yii2: - configFile: 'config/test.php' - -# To enable code coverage: -#coverage: -# #c3_url: http://localhost:8080/index-test.php/ -# enabled: true -# #remote: true -# #remote_config: '../codeception.yml' -# whitelist: -# include: -# - models/* -# - controllers/* -# - commands/* -# - mail/* -# blacklist: -# include: -# - assets/* -# - config/* -# - runtime/* -# - vendor/* -# - views/* -# - web/* -# - tests/* diff --git a/composer.json b/composer.json index 9522c57..c298067 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,6 @@ "phpcs": "phpcs --standard=phpcs.xml", "phpcs:fix": "php-cs-fixer fix --config=.php-cs-fixer.php --allow-risky yes", "phpcbf": "phpcbf -w -q > /dev/null || true", - "psalm": "psalm --show-info=true --threads=8", - "psalm:fix": "psalm --alter --issues=all", "post-install-cmd": [ "yii\\composer\\Installer::postInstall" ], @@ -27,7 +25,7 @@ ] }, "require": { - "php": "^8.1", + "php": ">=8", "ext-intl": "*", "ext-json": "*", "yiisoft/yii2": "~2.0.45", diff --git a/composer.lock b/composer.lock index 2c61aa6..13791be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4a173741a72eed304f47eddfc76d4f34", + "content-hash": "47483fcb72754cd078eb1e1ce7bdf36b", "packages": [ { "name": "bower-asset/bootstrap", @@ -1978,29 +1978,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -2027,7 +2028,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -2043,7 +2044,7 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "fakerphp/faker", @@ -2326,16 +2327,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.3", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/c6a951b75d684fd43fbbd69617488e1e2e8924ba", - "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { @@ -2373,7 +2374,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.3" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -2381,7 +2382,7 @@ "type": "tidelift" } ], - "time": "2022-03-02T14:16:47+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", @@ -5949,7 +5950,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^8.1", + "php": ">=8", "ext-intl": "*", "ext-json": "*" }, diff --git a/config/web.php b/config/web.php index 9a29ce5..a568b4b 100644 --- a/config/web.php +++ b/config/web.php @@ -8,6 +8,9 @@ $config = [ 'id' => 'yii2-skeleton', 'name' => 'Yii2 Skeleton', + 'language' => $_ENV['APP_LANGUAGE'] ?? 'pt_BR', + 'charset' => 'utf-8', + 'timeZone' => $_ENV['APP_TIMEZONE'] ?? 'America/Sao_Paulo', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'App\Controllers',