Skip to content
forked from mnvx/lowrapper

PHP wrapper over LibreOffice converter

License

Notifications You must be signed in to change notification settings

darkdarin/lowrapper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 DarkDarin\Lowrapper\Converter;
use DarkDarin\Lowrapper\LowrapperParameters;
use DarkDarin\Lowrapper\Format\TextFormatEnum;

// Create converter
$converter = new Converter();

// Describe parameters for converter
$parameters = (new LowrapperParameters(TextFormatEnum::DOCX))
    // HTML document
    ->setInputFile('test.html')
    // 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

About

PHP wrapper over LibreOffice converter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%