Add README

This commit is contained in:
icewind1991 2014-07-09 18:13:15 +02:00
commit f34ba01f56

75
README.md Normal file
View file

@ -0,0 +1,75 @@
SMB
===
PHP wrapper for `smbclient`
- Reuses a single `smbclient` instance for multiple requests
- Doesn't leak the password to the process list
- Simple 1-on-1 mapping of SMB commands
Examples
----
### Upload a file ###
```php
<?php
use Icewind\SMB\Server;
require('vendor/autoload.php');
$fileToUpload = __FILE__;
$server = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
$share->put($fileToUpload, 'example.txt');
```
### Download a file ###
```php
<?php
use Icewind\SMB\Server;
require('vendor/autoload.php');
$target = __DIR__ . '/target.txt';
$server = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
$share->get('example.txt', $target);
```
### List shares on the remote server ###
```php
<?php
use Icewind\SMB\Server;
require('vendor/autoload.php');
$server = new Server('localhost', 'test', 'test');
$shares = $server->listShares();
foreach ($shares as $share) {
echo $share->getName() . "\n";
}
```
### List the content of a folder ###
```php
<?php
use Icewind\SMB\Server;
require('vendor/autoload.php');
$server = new Server('localhost', 'test', 'test');
$share = $server->getShare('test');
$content = $share->dir('test');
foreach ($content as $name => $info) {
echo $name . "\n";
echo "\tsize :" . $info['size'] . "\n";
}
```