luilliarcec/laravel-imgur

This package is abandoned and no longer maintained. The author suggests using the yish/imgur package instead.

A simple package that allows interaction between Imgur and its application

1.0.1 2020-06-05 15:26 UTC

This package is auto-updated.

Last update: 2020-12-02 00:50:16 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads GitHub license

A simple package that allows interaction between Imgur and its application

Installation

You can install the package via composer:

composer require luilliarcec/laravel-imgur

Now publish the configuration file into your app's config directory, by running the following command:

php artisan vendor:publish --provider="Luilliarcec\LaravelImgur\LaravelImgurServiceProvider"

Now configure your imgur api credentials in your imgur.php configuration file

return [
    /*
    |--------------------------------------------------------------------------
    | Client ID
    |--------------------------------------------------------------------------
    |
    | Your ID obtained from Imgur to connect to the API
    |
    */

    'client_id' => env('IMGUR_CLIENT_ID', 'your_api_client_here'),
    
    /*****/
];

Or in your .env file

IMGUR_CLIENT_ID=YOUR_API_CLIENT

Usage

You can use the exposed Facade Luilliarcec\LaravelImgur\Facades\Imgur for faster use, or use the class Luilliarcec\LaravelImgur\Support\LaravelImgur

Upload

use Luilliarcec\LaravelImgur\Facades\Imgur;

function store(\Illuminate\Http\Request $request) {
    Imgur::upload($request->input('image'));
    
    $imageLink = Imgur::getLink();
}

// OR

function store(\Illuminate\Http\Request $request) {
    $imgur = Imgur::upload($request->input('image'));
    
    $imageLink = $imgur->link;
    // OR
    $imageLink = $imgur->getLink();
}

Remove

use Luilliarcec\LaravelImgur\Facades\Imgur;

function remove($hash) {
    Imgur::remove($hash);
    
    return Imgur::getResponse()->success; // True or False
}

// OR

function remove($hash) {
    return Imgur::remove($hash); // True or False
}

Thumbnails

use Luilliarcec\LaravelImgur\Facades\Imgur;

$link = 'https://i.imgur.com/7f1IiRr.jpg';

$newLink = Imgur::thumbnails($link, 'm');

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email luilliarcec@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.