viterbit/liboffice-converter
Composer 安装命令:
composer require viterbit/liboffice-converter
包简介
PHP wrapper over LibreOffice converter
README 文档
README
Simple way for documents conversion into various formats.
For example: html -> docx, html -> pdf, docx -> html and many more.
Usage
use Viterbit\LibOfficeConverter\Converter; use Viterbit\LibOfficeConverter\Parameters; use Viterbit\LibOfficeConverter\Format; // Create converter $converter = new Converter(); // Describe parameters for converter $parameters = (new Parameters()) // HTML document ->setInputFile('test.html') // Format of result document is docx ->setOutputFormat(Format::TEXT_DOCX) // Result file name ->setOutputFile('path-to-result-docx.docx'); // Run converter $converter->convert($parameters);
Requirements
- PHP 7+
- libreoffice-core
Installation
sudo add-apt-repository ppa:libreoffice/ppa sudo apt-get update sudo apt-get install default-jdk -y sudo apt-get install python-software-properties -y sudo apt-get install software-properties-common -y sudo apt-get install libreoffice-core --no-install-recommends sudo apt-get install libreoffice-writer composer require viterbit/liboffice-converter
Example of installation libreoffice into docker container:
FROM php:7.2-fpm WORKDIR /var/www/html # Install libreoffice headless RUN apt update -y \ && mkdir -p /usr/share/man/man1 \ && apt -y install default-jdk-headless libreoffice-core libreoffice-writer libreoffice-calc RUN mkdir -p /var/www/.cache/dconf \ && mkdir -p /var/www/.config/libreoffice \ && chmod -R ugo+rwx /var/www/.cache \ && chmod -R ugo+rwx /var/www/.config
Example of installation libreoffice into mac:
brew cask install libreoffice
note: bin located at /usr/local/bin/soffice
Run tests
./vendor/bin/phpunit
Contribute
First install check tools before commit. Node is required.
npm install
License
Released under the MIT license
统计信息
- 总下载量: 11.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-08