- Clone this gist
- Run
make test.docx
- The file test.docx should be created
Last active
July 17, 2017 09:25
-
-
Save agallou/7bb2373491f713bfc94fd622a02b9754 to your computer and use it in GitHub Desktop.
Test PHPOffice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"phpoffice/phpword": "^0.13.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_readme": [ | |
"This file locks the dependencies of your project to a known state", | |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | |
"This file is @generated automatically" | |
], | |
"content-hash": "3d4e21b4202297b377881c19134e9fa9", | |
"packages": [ | |
{ | |
"name": "pclzip/pclzip", | |
"version": "2.8.2", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/ivanlanin/pclzip.git", | |
"reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", | |
"reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", | |
"shasum": "" | |
}, | |
"type": "library", | |
"autoload": { | |
"classmap": [ | |
"pclzip.lib.php" | |
] | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"LGPL-2.1" | |
], | |
"authors": [ | |
{ | |
"name": "Vincent Blavet" | |
} | |
], | |
"description": "A PHP library that offers compression and extraction functions for Zip formatted archives", | |
"homepage": "http://www.phpconcept.net/pclzip", | |
"keywords": [ | |
"php", | |
"zip" | |
], | |
"time": "2014-06-05T11:42:24+00:00" | |
}, | |
{ | |
"name": "phpoffice/common", | |
"version": "v0.2.6", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/PHPOffice/Common.git", | |
"reference": "c9be70c80637c28c728be78e66aad4878a34f8dd" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/PHPOffice/Common/zipball/c9be70c80637c28c728be78e66aad4878a34f8dd", | |
"reference": "c9be70c80637c28c728be78e66aad4878a34f8dd", | |
"shasum": "" | |
}, | |
"require": { | |
"pclzip/pclzip": "^2.8", | |
"php": ">=5.3.0" | |
}, | |
"require-dev": { | |
"phpdocumentor/phpdocumentor": "2.*", | |
"phploc/phploc": "2.*", | |
"phpmd/phpmd": "2.*", | |
"phpunit/phpunit": "3.7.*", | |
"sebastian/phpcpd": "2.*", | |
"squizlabs/php_codesniffer": "2.*" | |
}, | |
"type": "library", | |
"autoload": { | |
"psr-4": { | |
"PhpOffice\\Common\\": "src/Common/" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"LGPL" | |
], | |
"authors": [ | |
{ | |
"name": "Mark Baker" | |
}, | |
{ | |
"name": "Franck Lefevre", | |
"homepage": "http://rootslabs.net" | |
} | |
], | |
"description": "PHPOffice Common", | |
"homepage": "http://phpoffice.github.io", | |
"keywords": [ | |
"common", | |
"component", | |
"office", | |
"php" | |
], | |
"time": "2016-07-07T17:26:55+00:00" | |
}, | |
{ | |
"name": "phpoffice/phpword", | |
"version": "v0.13.0", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/PHPOffice/PHPWord.git", | |
"reference": "0a3f873972defb304de4fa2f5f53156558c11a7a" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/0a3f873972defb304de4fa2f5f53156558c11a7a", | |
"reference": "0a3f873972defb304de4fa2f5f53156558c11a7a", | |
"shasum": "" | |
}, | |
"require": { | |
"ext-xml": "*", | |
"php": ">=5.3.3", | |
"phpoffice/common": "0.2.*", | |
"zendframework/zend-escaper": "2.4.*", | |
"zendframework/zend-stdlib": "2.4.*", | |
"zendframework/zend-validator": "2.4.*" | |
}, | |
"require-dev": { | |
"dompdf/dompdf": "0.6.*", | |
"mpdf/mpdf": "5.*", | |
"phpdocumentor/phpdocumentor": "2.*", | |
"phploc/phploc": "2.*", | |
"phpmd/phpmd": "2.*", | |
"phpunit/phpunit": "3.7.*", | |
"squizlabs/php_codesniffer": "1.*", | |
"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", | |
"autoload": { | |
"psr-4": { | |
"PhpOffice\\PhpWord\\": "src/PhpWord" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"LGPL-3.0" | |
], | |
"authors": [ | |
{ | |
"name": "Mark Baker" | |
}, | |
{ | |
"name": "Franck Lefevre", | |
"homepage": "http://blog.rootslabs.net" | |
}, | |
{ | |
"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/" | |
} | |
], | |
"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": "2016-07-31T08:53:39+00:00" | |
}, | |
{ | |
"name": "zendframework/zend-escaper", | |
"version": "2.4.13", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/zendframework/zend-escaper.git", | |
"reference": "13f468ff824f3c83018b90aff892a1b3201383a9" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/13f468ff824f3c83018b90aff892a1b3201383a9", | |
"reference": "13f468ff824f3c83018b90aff892a1b3201383a9", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.3.23" | |
}, | |
"require-dev": { | |
"fabpot/php-cs-fixer": "1.7.*", | |
"phpunit/phpunit": "~4.0", | |
"satooshi/php-coveralls": "dev-master" | |
}, | |
"type": "library", | |
"extra": { | |
"branch-alias": { | |
"dev-master": "2.4-dev", | |
"dev-develop": "2.5-dev" | |
} | |
}, | |
"autoload": { | |
"psr-4": { | |
"Zend\\Escaper\\": "src/" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"BSD-3-Clause" | |
], | |
"homepage": "https://github.com/zendframework/zend-escaper", | |
"keywords": [ | |
"escaper", | |
"zf2" | |
], | |
"time": "2015-05-07T14:55:31+00:00" | |
}, | |
{ | |
"name": "zendframework/zend-stdlib", | |
"version": "2.4.13", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/zendframework/zend-stdlib.git", | |
"reference": "d8ecb629a72da9f91bd95c5af006384823560b42" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/d8ecb629a72da9f91bd95c5af006384823560b42", | |
"reference": "d8ecb629a72da9f91bd95c5af006384823560b42", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.3.23" | |
}, | |
"require-dev": { | |
"fabpot/php-cs-fixer": "1.7.*", | |
"phpunit/phpunit": "~4.0", | |
"satooshi/php-coveralls": "dev-master", | |
"zendframework/zend-eventmanager": "self.version", | |
"zendframework/zend-filter": "self.version", | |
"zendframework/zend-serializer": "self.version", | |
"zendframework/zend-servicemanager": "self.version" | |
}, | |
"suggest": { | |
"zendframework/zend-eventmanager": "To support aggregate hydrator usage", | |
"zendframework/zend-filter": "To support naming strategy hydrator usage", | |
"zendframework/zend-serializer": "Zend\\Serializer component", | |
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage" | |
}, | |
"type": "library", | |
"extra": { | |
"branch-alias": { | |
"dev-master": "2.4-dev", | |
"dev-develop": "2.5-dev" | |
} | |
}, | |
"autoload": { | |
"psr-4": { | |
"Zend\\Stdlib\\": "src/" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"BSD-3-Clause" | |
], | |
"homepage": "https://github.com/zendframework/zend-stdlib", | |
"keywords": [ | |
"stdlib", | |
"zf2" | |
], | |
"time": "2015-07-21T13:55:46+00:00" | |
}, | |
{ | |
"name": "zendframework/zend-validator", | |
"version": "2.4.13", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/zendframework/zend-validator.git", | |
"reference": "81415511fe729e6de19a61936313cef43c80d337" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/zendframework/zend-validator/zipball/81415511fe729e6de19a61936313cef43c80d337", | |
"reference": "81415511fe729e6de19a61936313cef43c80d337", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.3.23", | |
"zendframework/zend-stdlib": "~2.4.0" | |
}, | |
"require-dev": { | |
"fabpot/php-cs-fixer": "1.7.*", | |
"phpunit/phpunit": "~4.0", | |
"satooshi/php-coveralls": "dev-master", | |
"zendframework/zend-config": "~2.4.0", | |
"zendframework/zend-db": "~2.4.0", | |
"zendframework/zend-filter": "~2.4.0", | |
"zendframework/zend-i18n": "~2.4.0", | |
"zendframework/zend-math": "~2.4.0", | |
"zendframework/zend-servicemanager": "~2.4.0", | |
"zendframework/zend-session": "~2.4.0", | |
"zendframework/zend-uri": "~2.4.0" | |
}, | |
"suggest": { | |
"zendframework/zend-db": "Zend\\Db component", | |
"zendframework/zend-filter": "Zend\\Filter component, required by the Digits validator", | |
"zendframework/zend-i18n": "Zend\\I18n component to allow translation of validation error messages as well as to use the various Date validators", | |
"zendframework/zend-math": "Zend\\Math component", | |
"zendframework/zend-resources": "Translations of validator messages", | |
"zendframework/zend-servicemanager": "Zend\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", | |
"zendframework/zend-session": "Zend\\Session component", | |
"zendframework/zend-uri": "Zend\\Uri component, required by the Uri and Sitemap\\Loc validators" | |
}, | |
"type": "library", | |
"extra": { | |
"branch-alias": { | |
"dev-master": "2.4-dev", | |
"dev-develop": "2.5-dev" | |
} | |
}, | |
"autoload": { | |
"psr-4": { | |
"Zend\\Validator\\": "src/" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"BSD-3-Clause" | |
], | |
"description": "provides a set of commonly needed validators", | |
"homepage": "https://github.com/zendframework/zend-validator", | |
"keywords": [ | |
"validator", | |
"zf2" | |
], | |
"time": "2015-09-08T21:04:17+00:00" | |
} | |
], | |
"packages-dev": [], | |
"aliases": [], | |
"minimum-stability": "stable", | |
"stability-flags": [], | |
"prefer-stable": false, | |
"prefer-lowest": false, | |
"platform": [], | |
"platform-dev": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.1.2 | |
RUN apt-get update && apt-get install -y git | |
RUN apt-get update && apt-get install -y zlib1g-dev | |
RUN docker-php-ext-install zip | |
RUN apt-get update && apt-get install -y wget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.build-docker: Dockerfile | |
docker build -t test-phpoffice . | |
echo .build-docker | |
test.docx: .build-docker | |
docker run -w /sources -v $(PWD):/sources -ti test-phpoffice make vendor | |
docker run -w /sources -v $(PWD):/sources -ti test-phpoffice php test.php | |
bash: .build-docker | |
docker run -w /sources -v $(PWD):/sources -ti test-phpoffice /bin/bash | |
composer.phar: | |
$(eval EXPECTED_SIGNATURE = "$(shell wget -q -O - https://composer.github.io/installer.sig)") | |
$(eval ACTUAL_SIGNATURE = "$(shell php -r "copy('https://getcomposer.org/installer', 'composer-setup.php'); echo hash_file('SHA384', 'composer-setup.php');")") | |
@if [ "$(EXPECTED_SIGNATURE)" != "$(ACTUAL_SIGNATURE)" ]; then echo "Invalid signature"; exit 1; fi | |
php composer-setup.php | |
rm composer-setup.php | |
vendor: composer.phar | |
php composer.phar install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
$phpWord = new \PhpOffice\PhpWord\PhpWord(); | |
$section = $phpWord->addSection(); | |
$section->addImage('logo_phpoffice.jpg'); | |
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); | |
$objWriter->save('test.docx'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment