mops1k / unoserver-client
PHP client for unoserver(ex. unoconv) converter.
v0.0.2
2024-07-07 13:27 UTC
Requires
- php: ^8.1
- symfony/options-resolver: ^6.0 || ^7.0
- symfony/process: ^6.0 || ^7.0
Requires (Dev)
- ext-fileinfo: *
- ergebnis/composer-normalize: ^2.42
- laravel/pint: 1.16.1
- phpstan/phpstan: 1.11.6
- phpstan/phpstan-phpunit: 1.4.0
- phpunit/phpunit: 11.2.6
README
Simple library to run unoconvert inside your php applications.
Installation
composer require mops1k/unoserver-client
Usage example
- From document:
<?php use Unoserver\Converter\ClientBuilder; use Unoserver\Converter\Wrapper\Remote; use Unoserver\Converter\Source\Format; $builder = new ClientBuilder(); $builder->init(Remote::class, [ 'command' => '/usr/bin/unoconvert', // path to unoconvert binary 'host' => '127.0.0.1', // remote unoserver host 'port' => 2003, // remote unoserver port ]); $client = $builder->fromDocument('/document/path.docx'); // set path to file convert from $client->toFormat(Format::PDF); // set format to convert to $file = $client->convert(); // will return \SplFileInfo object with converted file
- From spreadsheet:
<?php use Unoserver\Converter\ClientBuilder; use Unoserver\Converter\Wrapper\Remote; use Unoserver\Converter\Source\Format; $builder = new ClientBuilder(); $builder->init(Remote::class, [ 'command' => '/usr/bin/unoconvert', // path to unoconvert binary 'host' => '127.0.0.1', // remote unoserver host 'port' => 2003, // remote unoserver port ]); $client = $builder->fromSpreadsheet('/document/path.xlsx'); // set path to file convert from $client->toFormat(Format::PDF); // set format to convert to $file = $client->convert(); // will return \SplFileInfo object with converted file
More docs soon...