Thinkphp5.1版本開始,官網不再提供下載版本,需要使用 `Composer` 或者 `git` 方式安裝和更新。
下面就詳細講解一下在 `Windows` 操作系統中用 `Composer` 安裝的流程:
>[danger] ThinkPHP5.1的環境要求如下:
~~~
PHP >= 5.6.0
PDO PHP Extension
MBstring PHP Extension
~~~
### 安裝前準備
>[success] 在 Windows 中,你需要下載并運行 [Composer-Setup.exe](https://getcomposer.org/Composer-Setup.exe)。
> 如果遇到任何問題或者想更深入地學習 Composer,請參考 [Composer 中文](http://www.hmoore.net/thinkphp/composer)。
[安裝 Composer-Setup.exe 軟件教程 請點擊這里](http://www.hmoore.net/yjf-kj/v2018/743788)
>[success] 安裝 Composer 完成后,再繼續下面的操作。
> 打開CMD命令行窗口 ( 按住win鍵+R鍵 然后輸入 cmd 再按回車鍵即可 )
> 比如將Thinkphp5.1安裝到 F 盤下的Thinkphp,在命令行窗口輸入
> 需要先切換到F盤,看圖操作吧.~\_~

現在你的CMD命令行窗口界面應該是這樣的:如上圖所示
~~~
F:\Thinkphp>
~~~
第一步:選擇鏡像
~~~
composer config -g repo.packagist composer https://packagist.laravel-china.org
~~~
>[danger] 運行后可能會出現:
> No composer.json in current directory, do you want to use the one at F:\\Thinkphp? \[Y,n\]?
> 只需要輸入 Y 即可.**(不出現不用管,繼續下面的操作)**
第二步:開始安裝 (如果你是第一次安裝的話)
~~~
composer create-project topthink/think tp5
~~~
上面的 `tp5` 目錄名你可以任意更改,執行完畢后,會在當前Thinkphp目錄下的tp5子目錄安裝最新版本的ThinkPHP,這個目錄就是我們后面會經常提到的應用根目錄。
>[success] 當你看到這個圖所示證明安裝成功了. 打開你的電腦F盤看看, 是不是很激動咧...

### 安裝完成 ~\_~!
>[info] 溫馨提示:
> 如果你之前已經安裝過,那么切換到你的應用根目錄下面,然后執行下面的命令進行更新:
~~~
composer update topthink/framework
~~~
*****
*****
你可能需要安裝的擴展,先進入到 應用根目錄 (就是上面說到的tp5目錄)
現在你的CMD命令行窗口界面最后一行應該是這樣的:
~~~
F:\Thinkphp>tp5>
~~~
>[success] 確認目錄正確后,繼續在命令行窗口輸入以下代碼安裝擴展
驗證碼
~~~
composer require topthink/think-captcha
~~~
圖片處理
~~~
composer require topthink/think-image
~~~
常用助手
~~~
composer require topthink/think-helper
~~~
#### 安裝擴展的步驟 如圖所示

下面的備用,需要的話,自己安裝咯...
針對ThinkPHP5的擴展包 需要使用Composer安裝
| 擴展名 | 地址 |
| --- | --- |
| 應用單元測試 | [https://github.com/top-think/think-testing.git](https://github.com/top-think/think-testing.git) |
| 驗證碼 | [https://github.com/top-think/think-captcha.git](https://github.com/top-think/think-captcha.git) |
| 隊列 | [https://github.com/top-think/think-queue.git](https://github.com/top-think/think-queue.git) |
| MongoDb支持 | [https://github.com/top-think/think-mongo.git](https://github.com/top-think/think-mongo.git) |
| angular模板引擎 | [https://github.com/top-think/think-angular.git](https://github.com/top-think/think-angular.git) |
| 助手庫 | [https://github.com/top-think/think-helper.git](https://github.com/top-think/think-helper.git) |
| 數據庫遷移工具 | [https://github.com/top-think/think-migration.git](https://github.com/top-think/think-migration.git) |