From 50ad603fceaaedc916439d1bae15137c69f89962 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 13 Mar 2019 17:44:46 +0100 Subject: [PATCH] added backend application and Gii --- .gitignore | 6 +- Makefile | 25 + README.md | 1 + api/Makefile | 38 ++ api/router.php | 17 + backend/Makefile | 38 ++ backend/config/app-dev.php | 27 + backend/config/app-prod.php | 15 + backend/config/app-test.php | 15 + backend/config/app.php | 22 + backend/config/components.php | 48 ++ backend/config/url-rules.php | 7 + backend/controllers/SiteController.php | 16 + backend/router.php | 17 + backend/views/layouts/main.php | 29 + backend/views/site/index.php | 10 + backend/web/.htaccess | 6 + backend/web/assets/.gitignore | 2 + backend/web/index.php | 8 + backend/web/robots.txt | 2 + composer.json | 15 +- composer.lock | 898 +++++++++++++++++++++++++ config/components.php | 5 + config/env.php | 12 +- 24 files changed, 1269 insertions(+), 10 deletions(-) create mode 100644 Makefile create mode 100644 api/Makefile create mode 100644 api/router.php create mode 100644 backend/Makefile create mode 100644 backend/config/app-dev.php create mode 100644 backend/config/app-prod.php create mode 100644 backend/config/app-test.php create mode 100644 backend/config/app.php create mode 100644 backend/config/components.php create mode 100644 backend/config/url-rules.php create mode 100644 backend/controllers/SiteController.php create mode 100644 backend/router.php create mode 100644 backend/views/layouts/main.php create mode 100644 backend/views/site/index.php create mode 100644 backend/web/.htaccess create mode 100644 backend/web/assets/.gitignore create mode 100644 backend/web/index.php create mode 100644 backend/web/robots.txt create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 49ce3c1..b8812ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -/vendor \ No newline at end of file +/vendor + +/*/*.pid +/*/*.log +session_mm_*.sem diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f3c5afb --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ + +default: + @echo "The following commands are available:" + @echo "" + @echo " make start start PHP built-in webserver" + @echo " make stop stop PHP built-in webserver" + +# start PHP built-in webserver +start: + @echo "Starting server for api" + cd api && $(MAKE) start + @echo "Starting server for backend" + cd backend && $(MAKE) start + +# stop PHP built-in webserver +stop: + cd api && $(MAKE) stop + cd backend && $(MAKE) stop + +test: + cd api && $(MAKE) test + +clean: stop + +.PHONY: start stop clean test diff --git a/README.md b/README.md index 62736ca..0543335 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Yii Framework Application Template for quickly building API-first applications. git clone https://github.com/cebe/yii2-app-api my-api cd my-api + composer install ## Overview diff --git a/api/Makefile b/api/Makefile new file mode 100644 index 0000000..a0d164d --- /dev/null +++ b/api/Makefile @@ -0,0 +1,38 @@ +# additional arguments to PHP binary +PHPARGS= +# enable XDEBUG for the test runner +XDEBUG=0 +# enable XDEBUG for the webserver +XDEBUGW=0 + +WEBPORT=8337 + +ifeq ($(XDEBUG),1) + XDEBUGARGS=-dzend_extension=xdebug.so -dxdebug.remote_enable=1 +endif +ifeq ($(XDEBUGW),1) + XDEBUGARGSW=-dzend_extension=xdebug.so -dxdebug.remote_enable=1 +endif + + +current_dir=$(shell pwd) + +default: + +start: stop + @echo "Starting PHP webserver at http://localhost:$(WEBPORT), see php.log for access log." + @echo "" + @echo "Run make stop to stop it." + @echo "" + YII_ENV=dev php $(PHPARGS) $(XDEBUGARGSW) -S localhost:$(WEBPORT) -t web $(current_dir)/router.php >php.log 2>&1 & echo "$$!" > php.pid + +stop: + @echo "Stopping PHP webserver..." + @-if [ -f php.pid ] ; then kill $$(cat php.pid); fi + @rm -f php.pid + @rm -f session_mm_*.sem + +clean: stop + rm -f php.log + +.PHONY: start stop clean diff --git a/api/router.php b/api/router.php new file mode 100644 index 0000000..19006ea --- /dev/null +++ b/api/router.php @@ -0,0 +1,17 @@ +php.log 2>&1 & echo "$$!" > php.pid + +stop: + @echo "Stopping PHP webserver..." + @-if [ -f php.pid ] ; then kill $$(cat php.pid); fi + @rm -f php.pid + @rm -f session_mm_*.sem + +clean: stop + rm -f php.log + +.PHONY: start stop clean diff --git a/backend/config/app-dev.php b/backend/config/app-dev.php new file mode 100644 index 0000000..7bec183 --- /dev/null +++ b/backend/config/app-dev.php @@ -0,0 +1,27 @@ + array_merge( + require __DIR__ . '/../../config/components.php', // common config + require __DIR__ . '/../../config/components-dev.php', // common config (env overrides) + require __DIR__ . '/components.php' // backend specific config + ), +]); + +// enable Gii module +$config['bootstrap'][] = 'gii'; +$config['modules']['gii'] = [ + 'class' => yii\gii\Module::class, + 'generators' => [ + // add ApiGenerator to Gii module + 'api' => \cebe\yii2openapi\generator\ApiGenerator::class, + ], +]; + +return $config; diff --git a/backend/config/app-prod.php b/backend/config/app-prod.php new file mode 100644 index 0000000..3fbe071 --- /dev/null +++ b/backend/config/app-prod.php @@ -0,0 +1,15 @@ + array_merge( + require __DIR__ . '/../../config/components.php', // common config + require __DIR__ . '/../../config/components-prod.php', // common config (env overrides) + require __DIR__ . '/components.php' // backend specific config + ), +]); diff --git a/backend/config/app-test.php b/backend/config/app-test.php new file mode 100644 index 0000000..3322aee --- /dev/null +++ b/backend/config/app-test.php @@ -0,0 +1,15 @@ + array_merge( + require __DIR__ . '/../../config/components.php', // common config + require __DIR__ . '/../../config/components-test.php', // common config (env overrides) + require __DIR__ . '/components.php' // backend specific config + ), +]); diff --git a/backend/config/app.php b/backend/config/app.php new file mode 100644 index 0000000..0bd3039 --- /dev/null +++ b/backend/config/app.php @@ -0,0 +1,22 @@ + 'backend', + + 'basePath' => dirname(__DIR__), + 'vendorPath' => dirname(__DIR__, 2) . '/vendor', + 'runtimePath' => dirname(__DIR__, 2) . '/runtime/backend', + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], + 'controllerNamespace' => 'backend\controllers', + + 'bootstrap' => ['log'], + + 'params' => require(__DIR__ . '/../../config/params.php'), +]; diff --git a/backend/config/components.php b/backend/config/components.php new file mode 100644 index 0000000..701cfb3 --- /dev/null +++ b/backend/config/components.php @@ -0,0 +1,48 @@ + [ + 'cookieValidationKey' => 'api1337', // TODO this should be dynamic + ], + + 'urlManager' => [ + 'enablePrettyUrl' => true, + 'enableStrictParsing' => true, + 'showScriptName' => false, + 'rules' => require(__DIR__ . '/url-rules.php'), + ], + 'log' => [ + 'traceLevel' => YII_DEBUG ? 3 : 0, + 'targets' => [ + [ + 'class' => yii\log\FileTarget::class, + 'levels' => ['error', 'warning'], + 'logFile' => '@logs/backend-app.error.log', + 'except' => [ + 'yii\web\HttpException*', + ], + ], + [ + 'class' => yii\log\FileTarget::class, + 'levels' => ['error', 'warning'], + 'logFile' => '@logs/backend-http.error.log', + 'categories' => [ + 'yii\web\HttpException*', + ], + ], + [ + 'class' => yii\log\FileTarget::class, + 'levels' => ['info'], + 'logFile' => '@logs/backend-app.info.log', + 'logVars' => [], + 'except' => [ + 'yii\db\*', + ], + ], + ], + ], +]; diff --git a/backend/config/url-rules.php b/backend/config/url-rules.php new file mode 100644 index 0000000..49e491f --- /dev/null +++ b/backend/config/url-rules.php @@ -0,0 +1,7 @@ + 'site/index', +]; diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php new file mode 100644 index 0000000..bcd4d87 --- /dev/null +++ b/backend/controllers/SiteController.php @@ -0,0 +1,16 @@ +render('index'); + } +} diff --git a/backend/router.php b/backend/router.php new file mode 100644 index 0000000..19006ea --- /dev/null +++ b/backend/router.php @@ -0,0 +1,17 @@ + +beginPage() ?> + + + + + + + <?= Html::encode(empty($this->title) ? '' : $this->title . ' - ') ?> + head() ?> + + +beginBody() ?> + +
+ +
+ +endBody() ?> + + +endPage() ?> diff --git a/backend/views/site/index.php b/backend/views/site/index.php new file mode 100644 index 0000000..c46f4b2 --- /dev/null +++ b/backend/views/site/index.php @@ -0,0 +1,10 @@ + +

API Backend

+ +Go to to generate an API from OpenAPI spec. diff --git a/backend/web/.htaccess b/backend/web/.htaccess new file mode 100644 index 0000000..14d2dd0 --- /dev/null +++ b/backend/web/.htaccess @@ -0,0 +1,6 @@ +RewriteEngine on +# If a directory or a file exists, use the request directly +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +# Otherwise forward the request to index.php +RewriteRule . index.php \ No newline at end of file diff --git a/backend/web/assets/.gitignore b/backend/web/assets/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/backend/web/assets/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/backend/web/index.php b/backend/web/index.php new file mode 100644 index 0000000..89fd222 --- /dev/null +++ b/backend/web/index.php @@ -0,0 +1,8 @@ +run(); diff --git a/backend/web/robots.txt b/backend/web/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/backend/web/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/composer.json b/composer.json index ffd348e..da62080 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "require": { "php": ">=7.1.0", - "cebe/assetfree-yii2": "~2.0.16", + "yiisoft/yii2": "~2.0.16", "cebe/php-openapi": "dev-master", "cebe/yii2-openapi": "dev-master", "yiisoft/yii2-gii": "~2.0.0 | ~2.1.0" @@ -15,6 +15,15 @@ } }, "config": { - "platform": {"php": "7.1.3"} - } + "platform": {"php": "7.1.3"}, + "fxp-asset": { + "enabled": false + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org" + } + ] } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..ac5542e --- /dev/null +++ b/composer.lock @@ -0,0 +1,898 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "3ffab4be22d7cd3876f153eade6ea3e3", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.4.1", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e", + "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1,<4.0" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ], + "time": "2019-02-13T15:55:38+00:00" + }, + { + "name": "bower-asset/inputmask", + "version": "3.3.11", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/Inputmask.git", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/inputmask.js", + "./dist/inputmask/inputmask.extensions.js", + "./dist/inputmask/inputmask.date.extensions.js", + "./dist/inputmask/inputmask.numeric.extensions.js", + "./dist/inputmask/inputmask.phone.extensions.js", + "./dist/inputmask/jquery.inputmask.js", + "./dist/inputmask/global/document.js", + "./dist/inputmask/global/window.js", + "./dist/inputmask/phone-codes/phone.js", + "./dist/inputmask/phone-codes/phone-be.js", + "./dist/inputmask/phone-codes/phone-nl.js", + "./dist/inputmask/phone-codes/phone-ru.js", + "./dist/inputmask/phone-codes/phone-uk.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.js", + "./dist/inputmask/bindings/inputmask.binding.js" + ], + "bower-asset-ignore": [ + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ], + "time": "2017-11-21T11:46:23+00:00" + }, + { + "name": "bower-asset/jquery", + "version": "3.3.1", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "9e8ec3d10fad04748176144f108d7355662ae75e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/9e8ec3d10fad04748176144f108d7355662ae75e", + "reference": "9e8ec3d10fad04748176144f108d7355662ae75e", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "browser", + "javascript", + "jquery", + "library" + ], + "time": "2018-01-20T17:26:57+00:00" + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + }, + "time": "2014-10-22T12:02:42+00:00" + }, + { + "name": "bower-asset/typeahead.js", + "version": "v0.11.1", + "source": { + "type": "git", + "url": "https://github.com/twitter/typeahead.js.git", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/588440f66559714280628a4f9799f0c4eb880a4a", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "require-dev": { + "bower-asset/jasmine-ajax": "~1.3.1", + "bower-asset/jasmine-jquery": "~1.5.2", + "bower-asset/jquery": "~1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/typeahead.bundle.js" + }, + "time": "2015-04-27T04:02:14+00:00" + }, + { + "name": "bower-asset/yii2-pjax", + "version": "2.0.7.1", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "aef7b953107264f00234902a3880eb50dafc48be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/aef7b953107264f00234902a3880eb50dafc48be", + "reference": "aef7b953107264f00234902a3880eb50dafc48be", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "CONTRIBUTING.md", + "vendor/", + "script/", + "test/" + ] + }, + "license": [ + "MIT" + ], + "time": "2017-10-12T10:11:14+00:00" + }, + { + "name": "cebe/markdown", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "9bac5e971dd391e2802dca5400bbeacbaea9eb86" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/9bac5e971dd391e2802dca5400bbeacbaea9eb86", + "reference": "9bac5e971dd391e2802dca5400bbeacbaea9eb86", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2018-03-26T11:24:36+00:00" + }, + { + "name": "cebe/php-openapi", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/cebe/php-openapi.git", + "reference": "40181638c6acde99a05529621eaf44284378ab87" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/php-openapi/zipball/40181638c6acde99a05529621eaf44284378ab87", + "reference": "40181638c6acde99a05529621eaf44284378ab87", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.1.0", + "symfony/yaml": "^4.0" + }, + "require-dev": { + "cebe/indent": "*", + "friendsofphp/php-cs-fixer": "~2.13.1", + "oai/openapi-specification": "3.0.2", + "phpunit/phpunit": "^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\openapi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "https://cebe.cc/", + "role": "Creator" + } + ], + "description": "READ OpenAPI yaml files and make the content accessable in PHP objects.", + "homepage": "https://github.com/cebe/php-openapi#readme", + "keywords": [ + "openapi" + ], + "time": "2019-01-03T13:24:12+00:00" + }, + { + "name": "cebe/yii2-openapi", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/cebe/yii2-openapi.git", + "reference": "e6d02728bc655fd8233afd21768c3d532e876e02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/yii2-openapi/zipball/e6d02728bc655fd8233afd21768c3d532e876e02", + "reference": "e6d02728bc655fd8233afd21768c3d532e876e02", + "shasum": "" + }, + "require": { + "cebe/php-openapi": "dev-master", + "php": ">=7.1.0", + "yiisoft/yii2": "~2.0.15", + "yiisoft/yii2-gii": "~2.0.0 | ~2.1.0" + }, + "require-dev": { + "cebe/indent": "*", + "friendsofphp/php-cs-fixer": "~2.13.1", + "phpunit/phpunit": "^6.5", + "yiisoft/yii2-gii": "dev-codefile-module-independent as 2.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\yii2openapi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "https://cebe.cc/", + "role": "Creator" + } + ], + "description": "Generate full REST API application from OpenAPI 3 specification.", + "homepage": "https://github.com/cebe/yii2-openapi#readme", + "keywords": [ + "openapi", + "rest", + "yii2" + ], + "time": "2019-03-13T10:41:22+00:00" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.10.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "d85d39da4576a6934b72480be6978fb10c860021" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", + "reference": "d85d39da4576a6934b72480be6978fb10c860021", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "simpletest/simpletest": "^1.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2018-02-23T01:58:20+00:00" + }, + { + "name": "phpspec/php-diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2016-04-07T12:29:16+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "backendtea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "761fa560a937fd7686e5274ff89dcfa87a5047df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/761fa560a937fd7686e5274ff89dcfa87a5047df", + "reference": "761fa560a937fd7686e5274ff89dcfa87a5047df", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2019-02-23T15:17:42+00:00" + }, + { + "name": "yiisoft/yii2", + "version": "2.0.16.1", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "089198cced57c4b8c9545ddc56001a1bd114b2dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/089198cced57c4b8c9545ddc56001a1bd114b2dd", + "reference": "089198cced57c4b8c9545ddc56001a1bd114b2dd", + "shasum": "" + }, + "require": { + "bower-asset/inputmask": "~3.2.2 | ~3.3.5", + "bower-asset/jquery": "3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": "~2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0 | ~1.2.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "~4.6", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "~2.0.4" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + }, + { + "name": "Dmitry Naumenko", + "email": "d.naumenko.a@gmail.com", + "role": "Core framework development" + }, + { + "name": "Boudewijn Vahrmeijer", + "email": "info@dynasource.eu", + "homepage": "http://dynasource.eu", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2019-02-28T07:03:06+00:00" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "2.0.9", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "4677951dda712dd99d5bf2a127eaee118dfea860" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/4677951dda712dd99d5bf2a127eaee118dfea860", + "reference": "4677951dda712dd99d5bf2a127eaee118dfea860", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": "~2.0.6" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/" + }, + { + "name": "Antonio Ramirez", + "email": "amigo.cobos@gmail.com" + }, + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2019-01-29T21:39:45+00:00" + }, + { + "name": "yiisoft/yii2-composer", + "version": "2.0.7", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "1439e78be1218c492e6cde251ed87d3f128b9534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/1439e78be1218c492e6cde251ed87d3f128b9534", + "reference": "1439e78be1218c492e6cde251ed87d3f128b9534", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2018-07-05T15:44:47+00:00" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "c02adc552bcf3a0ef6f3694a9dcbf209f4885ab1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/c02adc552bcf3a0ef6f3694a9dcbf209f4885ab1", + "reference": "c02adc552bcf3a0ef6f3694a9dcbf209f4885ab1", + "shasum": "" + }, + "require": { + "bower-asset/typeahead.js": "0.10.* | ~0.11.0", + "phpspec/php-diff": ">=1.0.2", + "yiisoft/yii2": "~2.0.14", + "yiisoft/yii2-bootstrap": "~2.0.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2018-12-08T10:07:49+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "cebe/php-openapi": 20, + "cebe/yii2-openapi": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.1.3" + } +} diff --git a/config/components.php b/config/components.php index 464d111..fd20459 100644 --- a/config/components.php +++ b/config/components.php @@ -11,4 +11,9 @@ 'class' => yii\caching\FileCache::class, 'cachePath' => '@root/runtime/cache', ], + 'db' => [ + 'class' => yii\db\Connection::class, + 'dsn' => 'sqlite:@root/runtime/database.sqlite', + 'charset' => 'utf8', + ], ]; diff --git a/config/env.php b/config/env.php index 6c46eec..61c6ed0 100644 --- a/config/env.php +++ b/config/env.php @@ -13,11 +13,11 @@ require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); // register aliases -Yii::setAlias('@root', __DIR__ . '/..'); -Yii::setAlias('@api', __DIR__ . '/../api'); -Yii::setAlias('@console', __DIR__ . '/../console'); -Yii::setAlias('@backend', __DIR__ . '/../backend'); -Yii::setAlias('@common', __DIR__ . '/../common'); -Yii::setAlias('@logs', __DIR__ . '/../logs'); +Yii::setAlias('@root', dirname(__DIR__)); +Yii::setAlias('@api', '@root/api'); +Yii::setAlias('@console', '@root/console'); +Yii::setAlias('@backend', '@root/backend'); +Yii::setAlias('@common', '@root/common'); +Yii::setAlias('@logs', '@root/logs'); require __DIR__ . '/events.php';