GithubHelp home page GithubHelp logo

flysystem-v3-smb-adapter's Introduction

SMB adapter for Flysystem v3

run-tests Latest Stable Version

This package enables you to communicate with SMB shares through Flysystem v3.

Installation

composer require jerodev/flysystem-v3-smb-adapter

Usage

The adapter uses the Icewind SMB package to communicate with the share.
To use the flysystem adapter, you have to pass it an instance of \Icewind\SMB\IShare. Below is an example of how to create a share instance using the factory provided by Icewind SMB.

$server = (new \Icewind\SMB\ServerFactory())->createServer(
    $config->host,
    new \Icewind\SMB\BasicAuth(
        $config->user,
        'test',
        $config->password
    )
);
$share = $server->getShare($config->share);

return new \Jerodev\Flysystem\Smb\SmbAdapter($share, '');

Laravel Filesystem

The package also ships with a Laravel service provider that automatically registers a driver for you. Laravel will discover this provider for you when installing this package. All you have to do is configure the share in your config/filesystems.php similar to the example below.

'disks' => [
    'smb_share' => [
        'driver' => 'smb',
        'workgroup' => 'WORKGROUP',
        'host' => \env('SMB_HOST', '127.0.0.1'),
        'path' => \env('SMB_PATH', 'test'),
        'username' => \env('SMB_USERNAME', ''),
        'password' => \env('SMB_PASSWORD', ''),
        
        // Optional Icewind SMB options
        'smb_version_min' => \Icewind\SMB\IOptions::PROTOCOL_SMB2,
        'smb_version_max' => \Icewind\SMB\IOptions::PROTOCOL_SMB2_24,
        'timeout' => 20,
    ],
],

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.