PHP code example of whatwedo / flysystem-smb

1. Go to this page and download the library: Download whatwedo/flysystem-smb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

whatwedo / flysystem-smb example snippets


use League\Flysystem\Filesystem;
use League\Flysystem\Memory\MemoryAdapter;


$serverFactory = new \Icewind\SMB\ServerFactory();
$auth = new \Icewind\SMB\BasicAuth('medsuite', 'workgroup', 'medsuite');
$server = $serverFactory->createServer('localhost', $auth);

$share = $server->getShare('Medsuite Share');
        
$filesystem = new Filesystem(new SmbAdapter($share));

$filesystem->write('new_file.txt', 'yay a new text file!');

$contents = $filesystem->read('new_file.txt');

// Explicitly set timestamp (e.g. for testing)
$filesystem->write('old_file.txt', 'very old content', ['timestamp' => 13377331]);