一软瞎、第一步Docker設(shè)置
允許PhpStorm連接到Docker
添加項(xiàng)目資源目錄,否則Docker無法寫入依賴包到項(xiàng)目目錄
二、PhpStorm配置
PhpStorm按Ctrl+Alt+S打開配置窗口豌熄,添加Docker昆码,一般使用默認(rèn)的就行
新建一個(gè)Composer項(xiàng)目,下邊是創(chuàng)建PHP slim框架的項(xiàng)目
也可以創(chuàng)建一個(gè)PHP空項(xiàng)目锰蓬,再初始化為Composer項(xiàng)目
選擇Docker服務(wù)及Composer鏡像
下面是一個(gè)php slim的簡單例子
{
"name": "wanphp/test",
"description": "測試",
"minimum-stability": "stable",
"license": "proprietary",
"authors": [
{
"name": "author's name",
"email": "email@example.com"
}
],
"require": {
"php": "^7.4",
"catfan/medoo": "^1.7",
"php-di/php-di": "^6.1",
"slim/psr7": "^1.2",
"slim/slim": "^4.5",
"defuse/php-encryption": "^2.2",
"league/oauth2-server": "^8.1",
"zircote/swagger-php": "^3.0",
"swagger-api/swagger-ui": "^3.34"
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/"
}
}
}
安裝項(xiàng)目依賴包
安裝完成就可以開始設(shè)計(jì)你的新項(xiàng)目了幔睬,是不是很方便。