Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.
/ unoconv Public archive

A Laravel wrapper for unoconv as a webservice.

Notifications You must be signed in to change notification settings

EBOOST/unoconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unoconv Laravel API

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');

About

A Laravel wrapper for unoconv as a webservice.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages