jerodev / flysystem-v3-smb-adapter
SMB adapter for Flysystem v3
Installs: 77 040
Dependents: 1
Suggesters: 0
Security: 0
Stars: 11
Watchers: 1
Forks: 7
Open Issues: 1
pkg:composer/jerodev/flysystem-v3-smb-adapter
Requires
- php: >=8.0.2
- icewind/smb: ^3.5
- league/flysystem: ^3.0
Requires (Dev)
- illuminate/filesystem: ^9.0
- illuminate/support: ^9.0
- jerodev/code-styles: dev-master
- league/flysystem-adapter-test-utilities: ^3.0
- orchestra/testbench: ^7.7
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.5
Suggests
- ext-smbclient: Required to use this package
This package is auto-updated.
Last update: 2025-10-19 22:23:05 UTC
README
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, ], ],