Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mnvx/lowrapper
PHP wrapper over LibreOffice converter
https://github.com/mnvx/lowrapper
docx docx-generator html libreoffice libreoffice-converter pdf pdf-converter pdf-generation
Last synced: about 3 hours ago
JSON representation
PHP wrapper over LibreOffice converter
- Host: GitHub
- URL: https://github.com/mnvx/lowrapper
- Owner: mnvx
- License: mit
- Created: 2017-01-18T21:30:25.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T15:33:40.000Z (2 months ago)
- Last Synced: 2025-01-30T02:06:28.649Z (7 days ago)
- Topics: docx, docx-generator, html, libreoffice, libreoffice-converter, pdf, pdf-converter, pdf-generation
- Language: PHP
- Size: 692 KB
- Stars: 125
- Watchers: 10
- Forks: 38
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Master Status: [![Build Status](https://travis-ci.org/mnvx/lowrapper.png?branch=master)](https://travis-ci.org/mnvx/lowrapper)
# PHP wrapper over LibreOffice converter
Simple way for documents conversion into various formats.For example: html -> docx, html -> pdf, docx -> html and many more.
![Formats](examples/formats.jpg "Formats")
## Usage
```php
use Mnvx\Lowrapper\Converter;
use Mnvx\Lowrapper\LowrapperParameters;
use Mnvx\Lowrapper\Format;// Create converter
$converter = new Converter();// Describe parameters for converter
$parameters = (new LowrapperParameters())
// 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);
```More [examples](/examples)
## Requirements
- PHP 5.5+
- libreoffice-core## Installation
```bash
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 mnvx/lowrapper
```Example of installation libreoffice into docker container:
```dockerfile
FROM php:7.2-fpmWORKDIR /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
```## Run tests
```bash
./vendor/bin/phpunit
```## License
Released under the MIT license