Git Product home page Git Product logo

flysystem-mailru-cloud's Introduction

Flysystem adapter for the Mail.ru Cloud (mod)

This package contains a Flysystem adapter for Mail.ru Cloud. Under the hood, the Friday14/mailru-cloud-php is used.

Installation

You can install the package via composer:

composer require freecod/flysystem-mailru-cloud

Usage

This package used unofficial API client for cloud.mail.ru - Friday14/mailru-cloud-php

To initialize the client, enter your login (without @domain), domain (mail.ru, list.ru, etc) and password to work with the cloud.

use Friday14\Mailru\Cloud;
use Freecod\FlysystemMailRuCloud\MailRuCloudAdapter;

$client = new Cloud('login', 'password', 'mail.ru');

$adapter = new MailRuCloudAdapter($client);

$filesystem = new Filesystem($adapter);

Usage in Laravel

To used this package as driver for Laravel Storage drive, you must make Service Provider for extend storage drivers

<?php

namespace App\Providers;

use Freecod\FlysystemMailRuCloud\MailRuCloudAdapter;
use Friday14\Mailru\Cloud;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;

class MailRuCloudServiceProvider extends ServiceProvider
{
    public function boot()
    {
        \Storage::extend('mailru', function ($app, $config) {
            $client = new Cloud(
                $config['login'],
                $config['password'],
                $config['domain']
            );
            
            return new Filesystem(new MailRuCloudAdapter($client));
        });
    }
}

Now add this Service Provider to config/app.php in section "providers":

App\Providers\MailRuCloudServiceProvider::class,

Final step - add to config/filesystems.php in section "disks"

    'mailru' => [
        'driver' => 'mailru',
        'login' => env('MAIL_RU_CLOUD_LOGIN'),
        'domain' => env('MAIL_RU_CLOUD_DOMAIN'),
        'password' => env('MAIL_RU_CLOUD_PASSWORD'),
    ],

Usage

    $data = \Storage::disk('mailru')->files();

License

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

flysystem-mailru-cloud's People

Contributors

freecod avatar scratcher28 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

soyket

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.