lowrapper

PHP wrapper over LibreOffice converter

Github stars Tracking Chart

Master Status: Build Status

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

Usage

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

Requirements

  • PHP 5.5+
  • 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 mnvx/lowrapper

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

Run tests

./vendor/bin/phpunit

License

Released under the MIT license

Main metrics

Overview
Name With Ownermnvx/lowrapper
Primary LanguagePHP
Program languagePHP (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2017-01-18 21:30:25
Pushed At2024-11-26 15:33:40
Last Commit At2024-11-26 16:32:10
Release Count12
Last Release Name1.0.12 (Posted on )
First Release Name1.0.0 (Posted on )
用户参与
Stargazers Count124
Watchers Count9
Fork Count38
Commits Count45
Has Issues Enabled
Issues Count11
Issue Open Count6
Pull Requests Count12
Pull Requests Open Count1
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private