eboost/unoconv

This package is abandoned and no longer maintained. No replacement package was suggested.

Convert documents using unoconv.

1.0 2016-11-01 16:30 UTC

This package is auto-updated.

Last update: 2021-02-16 11:49:25 UTC


README

A Laravel wrapper for unoconv as a webservice. See Convert for more details.

Installation

Install this package through Composer.

Add this to your composer.json dependencies:

Using Laravel 5.2+

"require": {
   "eboost/unoconv": "dev-master"
}

Run composer install to download the required files.

Next you need to add the service provider to config/app.php

'providers' => [
    ...
    Eboost\Unoconv\UnoconvServiceProvider::class
]

Set up the facade. Add the reference in config/app.php to your aliases array.

'aliases'  => [
    ...
    'Unoconv' => Eboost\Unoconv\Facades\Unoconv::class,
]

Publish the config

php artisan vendor:publish --provider="Eboost\Unoconv\UnoconvServiceProvider" --tag="config"

Usage

File conversion

# Convert the file to /file.pdf

Unoconv::file('/file.pptx')->to('pdf');
# Convert the file and save it in a different location /new/location/file.pdf

Unoconv::file('/file.pptx')->to('/new/location/file.pdf');

Chaining multiple conversions

# Convert the file to /file.pdf and /file.jpg

Unoconv::file('/file.pptx')->to(['pdf', 'jpg]);
# Convert the file to /file.pdf and /preview/file.jpg

Unoconv::file('/file.pptx')->to(['pdf', '/preview/file.jpg]);

Non-blocking conversion using a queue

To use queues you will need have set-up the default laravel queue listener.

Unoconv::file('/file.pptx')->queue('pdf');
# You can also specify the queue.

Unoconv::file('/file.pptx')->onQueue('image-converter', 'pdf');

Dispatch new job after conversion is done

Unoconv::file('/file.pptx')->after((new AfterConversionJob()))->to('pdf');