File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -150,3 +150,15 @@ $share->notify('')->listen(function (\Icewind\SMB\Change $change) {
150
150
echo $change->getCode() . ': ' . $change->getPath() . "\n";
151
151
});
152
152
```
153
+
154
+ ## Testing SMB
155
+
156
+ Use the following steps to check if the library can connect to your SMB share.
157
+
158
+ 1 . Clone this repository or download the source as [ zip] ( https://github.com/icewind1991/SMB/archive/master.zip )
159
+ 2 . Make sure [ composer] ( https://getcomposer.org/ ) is installed
160
+ 3 . Run ` composer install ` in the root of the repository
161
+ 4 . Edit ` example.php ` with the relevant settings for your share.
162
+ 5 . Run ` php example.php `
163
+
164
+ If everything works correctly then the contents of the share should be outputted.
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
use Icewind \SMB \NativeServer ;
3
4
use Icewind \SMB \Server ;
4
5
5
6
require ('vendor/autoload.php ' );
6
7
8
+ $ host = 'localhost ' ;
9
+ $ user = 'test ' ;
10
+ $ password = 'test ' ;
11
+ $ share = 'test ' ;
12
+
7
13
if (Server::NativeAvailable ()) {
8
- $ server = new NativeServer (' localhost ' , ' test ' , ' test ' );
14
+ $ server = new NativeServer ($ host , $ user , $ password );
9
15
} else {
10
- $ server = new Server (' localhost ' , ' test ' , ' test ' );
16
+ $ server = new Server ($ host , $ user , $ password );
11
17
}
12
18
13
- $ share = $ server ->getShare (' test ' );
19
+ $ share = $ server ->getShare ($ share );
14
20
15
21
$ files = $ share ->dir ('/ ' );
16
22
foreach ($ files as $ file ) {
You can’t perform that action at this time.
0 commit comments