# ****下载与安装****
[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压缩包。