Commit 74f2700d authored by nahakyuu's avatar nahakyuu

add database support & add dev doc

parent 460a7337
......@@ -38,4 +38,7 @@ bash ./bot/bot_enable.sh
passthru('"' . PHP_BINARY . '"' . " -S $address -t \"$documentRoot\" $router");
```
3. 修改`config/configuration.php`之后一定要运行`composer du`来重新生成`.merge-plan.php`
4. 目前只加入了`src``config`文件夹,demo文件见`C:\git\phpdts\src\Controller\HomeController.php`
\ No newline at end of file
4. 目前只加入了`src``config`文件夹,demo文件见`C:\git\phpdts\src\Controller\HomeController.php`
5. 可以使用[Yii Dev Panel](https://yiisoft.github.io/yii-dev-panel)来调试
6. 数据库配置请修改 `config\common\params.php`,默认使用`Yiisoft\Db\Mysql\ConnectionPDO`
7. 目前只用了`yii serve`使用php原生自带的Routing file功能做路由,nginx和`.htaccess`在做了在做了
\ No newline at end of file
......@@ -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": "2d0df35e2ca77cf06cd0f0898782f20d",
"content-hash": "44c30f2908958d905c354f1c41d950e1",
"packages": [
{
"name": "alexkart/curl-builder",
......@@ -1227,6 +1227,87 @@
],
"time": "2022-10-16T01:01:54+00:00"
},
{
"name": "yiisoft/active-record",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/active-record.git",
"reference": "e029fb40c2ec8fb578d2e277e82c5b5bd4a034a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/active-record/zipball/e029fb40c2ec8fb578d2e277e82c5b5bd4a034a2",
"reference": "e029fb40c2ec8fb578d2e277e82c5b5bd4a034a2",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^8.0",
"yiisoft/db": "^3.0@dev",
"yiisoft/factory": "^1.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.0",
"rector/rector": "^0.14",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.3|^5.6",
"yiisoft/aliases": "^2.0",
"yiisoft/cache": "^2.0|^3.0",
"yiisoft/db-mssql": "^1.0@dev",
"yiisoft/db-mysql": "^3.0@dev",
"yiisoft/db-oracle": "^1.0@dev",
"yiisoft/db-pgsql": "^3.0@dev",
"yiisoft/db-sqlite": "^3.0@dev",
"yiisoft/di": "^1.0",
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/json": "^1.0",
"yiisoft/log": "^2.0"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Yiisoft\\ActiveRecord\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Yii ActiveRecord Library",
"homepage": "https://www.yiiframework.com/",
"keywords": [
"Active Record",
"yii"
],
"support": {
"chat": "https://t.me/yii3en",
"forum": "https://www.yiiframework.com/forum/",
"irc": "irc://irc.freenode.net/yii",
"issues": "https://github.com/yiisoft/active-record/issues",
"source": "https://github.com/yiisoft/active-record",
"wiki": "https://www.yiiframework.com/wiki/"
},
"funding": [
{
"url": "https://github.com/yiisoft",
"type": "github"
},
{
"url": "https://opencollective.com/yiisoft",
"type": "open_collective"
}
],
"time": "2023-03-12T17:30:00+00:00"
},
{
"name": "yiisoft/aliases",
"version": "3.0.0",
......@@ -1663,6 +1744,164 @@
],
"time": "2023-02-15T13:28:02+00:00"
},
{
"name": "yiisoft/db",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/db.git",
"reference": "270b6b1e9ddaac0483632fd792668f638dd346d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/db/zipball/270b6b1e9ddaac0483632fd792668f638dd346d9",
"reference": "270b6b1e9ddaac0483632fd792668f638dd346d9",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pdo": "*",
"php": "^8.0",
"psr/log": "^2.0|^3.0",
"psr/simple-cache": "^2.0|^3.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.6|^10.0",
"rector/rector": "^0.14",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.6",
"yiisoft/aliases": "^1.1|^2.0",
"yiisoft/cache-file": "^2.0",
"yiisoft/di": "^1.0",
"yiisoft/event-dispatcher": "^1.0",
"yiisoft/json": "^1.0",
"yiisoft/log": "^2.0",
"yiisoft/var-dumper": "^1.5"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Yiisoft\\Db\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Yii DataBase Library",
"homepage": "https://www.yiiframework.com/",
"keywords": [
"database",
"yii"
],
"support": {
"chat": "https://t.me/yii3en",
"forum": "https://www.yiiframework.com/forum/",
"irc": "irc://irc.freenode.net/yii",
"issues": "https://github.com/yiisoft/db/issues/issues?state=open",
"source": "https://github.com/yiisoft/db",
"wiki": "https://www.yiiframework.com/wiki/"
},
"funding": [
{
"url": "https://github.com/yiisoft",
"type": "github"
},
{
"url": "https://opencollective.com/yiisoft",
"type": "open_collective"
}
],
"time": "2023-03-30T18:15:20+00:00"
},
{
"name": "yiisoft/db-mysql",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/db-mysql.git",
"reference": "c17e36b2b11b2afdd38eec1c396fd081c22423cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/db-mysql/zipball/c17e36b2b11b2afdd38eec1c396fd081c22423cd",
"reference": "c17e36b2b11b2afdd38eec1c396fd081c22423cd",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-json": "*",
"ext-pdo": "*",
"php": "^8.0",
"psr/log": "^2.0|^3.0",
"yiisoft/db": "^3.0@dev",
"yiisoft/json": "^1.0"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.5|^10.0",
"rector/rector": "^0.14",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.3|^5.6",
"yiisoft/aliases": "^2.0",
"yiisoft/cache": "^2.0",
"yiisoft/cache-file": "^2.0",
"yiisoft/log-target-file": "^2.0",
"yiisoft/var-dumper": "^1.5"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Yiisoft\\Db\\Mysql\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Yii DataBase MySQL Extension",
"homepage": "https://www.yiiframework.com/",
"keywords": [
"mysql",
"yii"
],
"support": {
"chat": "https://t.me/yii3en",
"forum": "https://www.yiiframework.com/forum/",
"irc": "irc://irc.freenode.net/yii",
"issues": "https://github.com/yiisoft/db-mysql/issues",
"source": "https://github.com/yiisoft/db-mysql",
"wiki": "https://www.yiiframework.com/wiki/"
},
"funding": [
{
"url": "https://github.com/yiisoft",
"type": "github"
},
{
"url": "https://opencollective.com/yiisoft",
"type": "open_collective"
}
],
"time": "2023-03-29T20:20:55+00:00"
},
{
"name": "yiisoft/definitions",
"version": "3.2.0",
......@@ -1961,6 +2200,69 @@
],
"time": "2022-10-27T12:02:21+00:00"
},
{
"name": "yiisoft/factory",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/yiisoft/factory.git",
"reference": "e93903c7960d0ff5897a9e36ff3b0ecb3ab25a8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/factory/zipball/e93903c7960d0ff5897a9e36ff3b0ecb3ab25a8d",
"reference": "e93903c7960d0ff5897a9e36ff3b0ecb3ab25a8d",
"shasum": ""
},
"require": {
"php": "^8.0",
"psr/container": "^1.0|^2.0",
"yiisoft/definitions": "^1.0|^2.0|^3.0.1"
},
"require-dev": {
"maglnet/composer-require-checker": "^4.2",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.14.3",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.18",
"yiisoft/test-support": "^1.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Yiisoft\\Factory\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Yii Factory",
"homepage": "https://www.yiiframework.com/",
"keywords": [
"factory"
],
"support": {
"chat": "https://t.me/yii3en",
"forum": "https://www.yiiframework.com/forum/",
"irc": "irc://irc.freenode.net/yii",
"issues": "https://github.com/yiisoft/factory/issues",
"source": "https://github.com/yiisoft/factory",
"wiki": "https://www.yiiframework.com/wiki/"
},
"funding": [
{
"url": "https://github.com/yiisoft",
"type": "github"
},
{
"url": "https://opencollective.com/yiisoft",
"type": "open_collective"
}
],
"time": "2022-11-08T08:54:16+00:00"
},
{
"name": "yiisoft/files",
"version": "2.0.0",
......@@ -5717,12 +6019,12 @@
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii-debug.git",
"reference": "20b397a336d7f31a227ac4f5f75d8c8d81ae0b89"
"reference": "fcb51240f0995eec2772da9047a87b80130e20b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii-debug/zipball/20b397a336d7f31a227ac4f5f75d8c8d81ae0b89",
"reference": "20b397a336d7f31a227ac4f5f75d8c8d81ae0b89",
"url": "https://api.github.com/repos/yiisoft/yii-debug/zipball/fcb51240f0995eec2772da9047a87b80130e20b8",
"reference": "fcb51240f0995eec2772da9047a87b80130e20b8",
"shasum": ""
},
"require": {
......@@ -5821,7 +6123,7 @@
"type": "open_collective"
}
],
"time": "2023-03-29T06:20:37+00:00"
"time": "2023-03-30T18:21:42+00:00"
},
{
"name": "yiisoft/yii-debug-api",
......@@ -5829,12 +6131,12 @@
"source": {
"type": "git",
"url": "https://github.com/yiisoft/yii-debug-api.git",
"reference": "5467dcf073ae2ff3cf807f8577a4ae3ac400c4f8"
"reference": "faf2cd9b89be733c68144467133458d4b1f8321f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yiisoft/yii-debug-api/zipball/5467dcf073ae2ff3cf807f8577a4ae3ac400c4f8",
"reference": "5467dcf073ae2ff3cf807f8577a4ae3ac400c4f8",
"url": "https://api.github.com/repos/yiisoft/yii-debug-api/zipball/faf2cd9b89be733c68144467133458d4b1f8321f",
"reference": "faf2cd9b89be733c68144467133458d4b1f8321f",
"shasum": ""
},
"require": {
......@@ -5928,7 +6230,7 @@
"type": "open_collective"
}
],
"time": "2023-03-15T10:32:55+00:00"
"time": "2023-03-30T19:52:08+00:00"
},
{
"name": "yiisoft/yii-gii",
......@@ -6261,6 +6563,9 @@
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"yiisoft/active-record": 20,
"yiisoft/db": 20,
"yiisoft/db-mysql": 20,
"yiisoft/request-model": 20,
"yiisoft/yii-debug": 20,
"yiisoft/yii-debug-api": 20,
......
<?php
declare(strict_types=1);
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Mysql\ConnectionPDO;
use Yiisoft\Db\Driver\PDO\PDODriverInterface;
use Yiisoft\Db\Mysql\PDODriver;
return [
ConnectionInterface::class => ConnectionPDO::class,
PDODriverInterface::class => PDODriver::class,
PDODriver::class => [
'__construct()' => [
'dsn' => $params['db']['dsn'],
'username' => $params['db']['username'],
'password' => $params['db']['password'],
]
]
];
......@@ -2,6 +2,18 @@
declare(strict_types=1);
use Yiisoft\Db\Mysql\Dsn;
$db = [
'driver' => 'mysql',
'host' => 'localhost',
'databaseName' => 'acdts3',
'port' => '3306',
'options' => ['charset' => 'utf8mb4'],
'username' => 'root',
'password' => 'mylittlepony',
];
return [
'app' => [
'charset' => 'UTF-8',
......@@ -20,4 +32,13 @@ return [
'@vendor' => '@root/vendor',
],
],
'db' => array_merge($db, [
'dsn' => (new Dsn(
$db['driver'],
$db['host'],
$db['databaseName'],
$db['port'],
$db['options']
))->asString(),
]),
];
<?php
declare(strict_types=1);
use Yiisoft\Definitions\DynamicReference;
use Yiisoft\Definitions\Reference;
use Yiisoft\Definitions\ReferencesArray;
use Yiisoft\Middleware\Dispatcher\MiddlewareDispatcher;
use Yiisoft\Yii\Http\Handler\NotFoundHandler;
use Yiisoft\Session\SessionMiddleware;
use Yiisoft\Csrf\CsrfMiddleware;
use Yiisoft\Router\Middleware\Router;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment