# ****下載與安裝****
[TOC]
## 一、基于composerp安裝:
現在的許多php插件很多都已經開始支持composer安裝,進入項目目錄文件后,在composer環境下輸入
```
composer require phpoffice/phpword
```
后等待提示安裝完成即可下載phpoffice團隊開發的phpword最新版。
最新版雖然是國外編輯的類庫,已經修復一些在對中文支持的問題。已經支持單元格的合并操作。
查看composer.lock信息可以知道
"php": "^5.3.3 || ^7.0",[//需要php版本為5.3.3以上
](#Top_of_Xia_20Zai_20Yu_20An_20Zhu)是依賴于"phpoffice/common0.2.9" 【//phpoffice/common模塊】
"zendframework/zend-escaper": "^2.2"
git地址為:[https://github.com/PHPOffice/PHPWord.git
](https://github.com/PHPOffice/PHPWord.git)zip包下載地址為:[https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9
](https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9)PHPWORD正式版0.16.0版發布于2018-12-30,最新版為0.17.0-dev【開發版】
以下為phpword在composer中的包信息。
```
{
"name": "phpoffice/phpword",
"version": "0.16.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPWord.git",
"reference": "7b7d4e4936014544aa706f4c03d3ac925d74beb9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9",
"reference": "7b7d4e4936014544aa706f4c03d3ac925d74beb9",
"shasum": "",
"mirrors": \[
{
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
"preferred": true
}
\]
},
"require": {
"ext-xml": "\*",
"php": "^5.3.3 || ^7.0",
"phpoffice/common": "^0.2.9",
"zendframework/zend-escaper": "^2.2"
},
"require-dev": {
"dompdf/dompdf": "0.8.\*",
"ext-gd": "\*",
"ext-zip": "\*",
"friendsofphp/php-cs-fixer": "^2.2",
"mpdf/mpdf": "5.7.4 || 6.\* || 7.\*",
"php-coveralls/php-coveralls": "1.1.0 || ^2.0",
"phploc/phploc": "2.\* || 3.\* || 4.\*",
"phpmd/phpmd": "2.\*",
"phpunit/phpunit": "^4.8.36 || ^7.0",
"squizlabs/php\_codesniffer": "^2.9",
"tecnickcom/tcpdf": "6.\*"
},
"suggest": {
"dompdf/dompdf": "Allows writing PDF",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing OOXML and ODF",
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"ext-zip": "Allows writing OOXML and ODF"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.17-dev"
}
},
"autoload": {
"psr-4": {
"PhpOffice\\\\PhpWord\\\\": "src/PhpWord"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": \[
"LGPL-3.0"
\],
"authors": \[
{
"name": "Mark Baker"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com",
"homepage": "http://gabrielbull.com/"
},
{
"name": "Ivan Lanin",
"homepage": "http://ivan.lanin.org"
},
{
"name": "Roman Syroeshko",
"homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net/blog/"
},
{
"name": "Antoine de Troostembergh"
}
\],
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
"homepage": "http://phpoffice.github.io",
"keywords": \[
"ISO IEC 29500",
"OOXML",
"Office Open XML",
"OpenDocument",
"OpenXML",
"PhpOffice",
"PhpWord",
"Rich Text Format",
"WordprocessingML",
"doc",
"docx",
"html",
"odf",
"odt",
"office",
"pdf",
"php",
"reader",
"rtf",
"template",
"template processor",
"word",
"writer"
\],
"time": "2018-12-30T00:35:03+00:00"
}
```
## 二、基于git安裝
git地址為:[https://github.com/PHPOffice/PHPWord.git](https://github.com/PHPOffice/PHPWord.git)
可以在git環境下輸入
git clone [https://github.com/PHPOffice/PHPWord.git](https://github.com/PHPOffice/PHPWord.git)
等待下載完成可即完成插件的下載。
## 三、下載壓縮文件
從網絡地址:[https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9](https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9)
下載zip壓縮包。