A Laravel wrapper for unoconv as a webservice. See Convert for more details.
Install this package through Composer.
Add this to your composer.json
dependencies:
"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"
# 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');
# 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]);
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');
Unoconv::file('/file.pptx')->after((new AfterConversionJob()))->to('pdf');