PHPackages                             happydemon/unoserver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. happydemon/unoserver

ActiveLibrary[File &amp; Storage](/categories/file-storage)

happydemon/unoserver
====================

Laravel wrapper to interact with UnoServer, which allows you to convert documents using LibreOffice.

0269PHP

Since Sep 29Pushed 9mo agoCompare

[ Source](https://github.com/happyDemon/unoserver)[ Packagist](https://packagist.org/packages/happydemon/unoserver)[ RSS](/packages/happydemon-unoserver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

UnoServer
=========

[](#unoserver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/bcb97f35ee987503db2b437fda4f6390675db03a11e56a1ce3935cb5b395ecbf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686170707964656d6f6e2f756e6f7365727665723f696e636c7564655f70726572656c6561736573)](https://packagist.org/packages/happydemon/unoserver)[![Total Downloads](https://camo.githubusercontent.com/3388081a41a8bf9d9f3a0ff271f7e00d8b7aae42a211bb95d2e9f06fd7f317a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686170707964656d6f6e2f756e6f7365727665723f6c6162656c3d646f776e6c6f616473267374796c653d736f6369616c)](https://packagist.org/packages/happydemon/unoserver)

This package is a Laravel-specific wrapper around [unoserver](https://github.com/unoconv/unoserver) commands, these let you easily convert office documents, like you would in LibreOffice.

Helper commands are provided to get you set up quickly.

Installation
------------

[](#installation)

Install the package in your project:

```
composer require happydemon/unoserver
```

#### Vendor publish

[](#vendor-publish)

You can run `vendor:publish --tag=unoserver` te publish the config file and the platform installers.

You can also be more specific in what you want to publish:

- `vendor:publish --tag=unoserver.config`
- `vendor:publish --tag=unoserver.platforms`

### Set up

[](#set-up)

To get started quickly we bundled install scripts, these got exported thanks to `vendor:publish`.

From your application's root directory you can run:

```
sh platforms/mac
sh platforms/ubuntu
```

For Mac it's important `homebrew` is installed, for Ubuntu `python3`

The script will install LibreOffice, unoserver &amp; set up some `.env` variables.

### Sail

[](#sail)

### Configuration

[](#configuration)

`vendor:publish` published the `unoserver.php` config file.

If you're making use of the generated `unoserver` command to start a server, you'll need to define the path to your local libreoffice esecutable.

```
# For mac usually: /Applications/LibreOffice.app/Contents/MacOS/soffice
UNOSERVER_EXEC_LIBRE=
```

You should always provide the path to a python executable that supports unoserver:

```
# For mac usually: /Applications/LibreOffice.app/Contents/Resources/python
UNOSERVER_EXEC_PYTHON=
```

**Important:** both `UNOSERVER_EXEC_LIBRE` and `UNOSERVER_EXEC_PYTHON` environment variables get configured automatically when you set up your environment with a [set-up script](#set-up).

Commands
--------

[](#commands)

### make:unoserver-cmd

[](#makeunoserver-cmd)

This command generates bash scripts to:

- start a unoserver
- send convert requests to that server

**arguments**

It takes a servername as the only argument (this would be a server you defined in the `unoserver.servers.*` config), if not provided it will use the default server.

*parameters*

Option--ip=IP the unoserver is hosted on (defaults to `127.0.0.1`)--port=Port the uno server is running on (defaults to `2002`)--unoserverGenerate unoserver in the app's bin folder--unoconvertGenerate unoconvert in the app's bin folder```
php artisan make:unoserver-cmd
```

This will generate 2 files in `base_path('bin')`:

- **unoserver:** lets you quickly start up a unoserver instance
- **unoconvert:** lets you correctly interact with a unoserver instance

If a server was defined as an argument, both files' name will be suffixed with that server name.

Always make sure there is a `bin/unoserver` running when developing locally.

Usage
-----

[](#usage)

The `HappyDemon\UnoServer\Facades\UnoServer` facade can be used to connect to a server and send it documents to convert for us.

### Configuration

[](#configuration-1)

Connections are defined under the `unoserver.servers` config.

There are 2 types configuration;

#### Script

[](#script)

You can define the path to a bash script.

You can check the output from `php artisan unoserver:helpers -h` as an example for a command file.

```
