altitude/laravel-uploadcare

Laravel Service for Uploadcare
8,634 7
Install
composer require altitude/laravel-uploadcare
Latest Version:2.0.1
PHP:>=5.4.0
License:MIT
Last Updated:Nov 2, 2016
Links: GitHub  ·  Packagist
Maintainer: altitude

Uploadcare for Laravel

This is a simple Laravel service provider for Uploadcare's official PHP library.

Installation

First, add this to your composer.json file

"require": {
    "illuminate/html": "5.*",
    "altitude/laravel-uploadcare": "~2.0.0"
}

Then, create config/uploadcare.php with the following

<?php

return array(
    'public_key'  => 'YOUR_UPLOADCARE_PUBLIC_KEY_HERE',
    'private_key' => 'YOUR_UPLOADCARE_PRIVATE_KEY_HERE',
);

Finally, add the service provider and alias in your config/app.php

'providers' => array(
    ...

    Illuminate\Html\HtmlServiceProvider::class,
    Altitude\LaravelUploadcare\LaravelUploadcareServiceProvider::class,
);

'aliases' => array(
    ...

    'Form' => Illuminate\Html\FormFacade::class,
    'HTML' => Illuminate\Html\HtmlFacade::class,
    'Uploadcare' => Altitude\LaravelUploadcare\Facades\Uploadcare::class,
);

And you should be good to go.

Example

This Service extends Uploadcare's API class so you can use any of its methods.

It also provides the form macro Form::uploadcare($field_name, $value = null, $options = array()).

app/Http/routes.php


Route::get('/demo', function(){
    return View::make('demo/demo');
});

Route::post('/demo', function(){
    echo Uploadcare::getFile(Input::get('image'))->getUrl();
});

resources/views/demo/demo.blade.php

<html>
<head>
    <title>Uploadcare Demo</title>
</head>
<body>
    <form method="POST" action="/demo">
        {!! Form::uploadcare('image', null, array('data-crop' => '3:4')) !!}
        <input type="submit">
    </form>
    {!! Uploadcare::scriptTag() !!}
</body>
</html>

For more information, please check the offical documentation

Laravel 4.x

This library is still available for Laravel 4.x. Please use the older 1.x releases and check their README.md for usage.

License

MIT license

Related Packages

vormkracht10/flysystem-uploadcare

Flysystem driver for Uploadcare for Laravel.

39,005 18
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609

Version History

Version Released PHP Laravel License
2.0.1 >=5.4.0 >=5.0.0 MIT
2.0.0 >=5.4.0 >=5.0.0 MIT
1.2.0 >=5.4.0 4.2.* MIT
1.1.0 >=5.4.0 4.2.* MIT
1.0.0 >=5.4.0 4.2.* MIT