mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Add README
This commit is contained in:
parent
46e2daf1ee
commit
f34ba01f56
1 changed files with 75 additions and 0 deletions
75
README.md
Normal file
75
README.md
Normal 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";
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue