/file-handler

Primary LanguagePHPMIT LicenseMIT

File Handler

Packagist Packagist Packagist

Description

You can send your files to remote server application (YasinKose/lumen-file-storage-service) using this repository.

Installation

Install via composer

composer require yasinkose/file-handler

Add the following to your .env file

FILE_HANDLER_URL=https://***.com/
FILE_HANDLER_API_KEY=api_key
FILE_HANDLER_TABLE_NAME=files

Publish package assets

If you are using Laravel run this command

php artisan vendor:publish --provider="YasinKose\FileHandler\ServiceProvider"

or if you're using Lumen, Add the following snippet to the bootstrap/app.php file under the providers section as follows:

$app->register(YasinKose\FileHandler\ServiceProvider::class);

Usage

Here's how you can send files:

FileHandler::sendFile($request->allFiles());

OR

FileHandler::addFile($request->allFiles())->sendFile();

OR

$file = new FileHandler();
$file->sendFile($request->allFiles());

Here's the response you'll get

Array
(
    [0] => stdClass Object
        (
            [original_name] => screenshot_1.png
            [slug] => lHVRttkrqM
            [url] => https://***.com/file/lHVRttkrqM
        )

    [1] => stdClass Object
        (
            [original_name] => screenshot_2.png
            [slug] => kC8Svz0njs
            [url] => https://***.com/file/kC8Svz0njs
        )
)

Security

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

Contributors ✨

Thanks goes to these people: