LaravelPackages.net
Acme Inc.
Toggle sidebar
onlineuniconverter/onlineuniconverter-laravel

Laravel PHP SDK for OnlineUniConverter APIs

3
1
v2.0.0
About onlineuniconverter/onlineuniconverter-laravel

onlineuniconverter/onlineuniconverter-laravel is a Laravel package for laravel php sdk for onlineuniconverter apis. It currently has 1 GitHub stars and 3 downloads on Packagist (latest version v2.0.0). Install it with composer require onlineuniconverter/onlineuniconverter-laravel. Discover more Laravel packages by onlineuniconverter or browse all Laravel packages to compare alternatives.

Last updated

Online-UniConverter-laravel

This is the official Laravel package for the OnlineUniConverter API v2

Tests Latest Stable Version Total Downloads Latest Unstable Version License

Installation

You can install the package via composer:

composer require onlineuniconverter/onlineuniconverter-laravel

This package requires a HTTP client. It works both with Guzzle 6 and 7. If you are using Guzzle 6, you need an adapter:

composer require php-http/guzzle6-adapter

Guzzle 7 works out of the box.

Next you must publish the config file.

php artisan vendor:publish --provider="OnlineUniConverter\Laravel\Providers\OnlineUniConverterServiceProvider"

This is the content that will be published to config/onlineuniconverter.php:

Usage

File conversion

# Init Convert Class

$onlineUniConverter = new \OnlineUniConverter\Laravel\OnlineUniConverter(config('onlineuniconverter'));
# Convert the file to /a/path/to/file.mp4

$onlineUniConverter->from('/a/path/to/file.mov')->to('mp4')->convert();
# Convert the file and save it in a different location /a/new/path/to/new.mp4

$onlineUniConverter->from('/a/path/to/biggles.webm')->to('/a/new/path/to/new.mp4')->convert();
# It also works with Laravel's file upload

if (Input::hasFile('photo'))
{
    $onlineUniConverter->from( Input::file('photo') )->to('/a/local/path/profile_image.jpg')->convert();
}
# Compress the image to kitty.jpg with ratio of 70%

$onlineUniConverter->from('kitty.png')->ratio(0.7)->to('jpg')->compress();

Remote files

It will also work with converting remote files (just make sure you provide a path to save it to)

# Convert Google's SVG logo hosted on Wikipedia to a png on your server

$onlineUniConverter->from('http://upload.wikimedia.org/wikipedia/commons/a/aa/Logo_Google_2013_Official.svg')->to('images/google.png')->convert();

You can use the OnlineUniConverter to see the available options for the various task types.

Tests

vendor/bin/phpunit 

Resources

Comments