Digging in owncloud code and dependencies, I just notice some libraries and a PHP extension:

In all case, to access Windows files from Linux, you need to use the Samba software.

As I understand the need of a pure PHP implementation (icewind/smb), I think that a wrapper above the smbclient command is terribly ugly, and really not robust.

From a first look, libsmbclient-php is interesting, but quite messy to use, as you have to use dedicated functions (smbclient_*).

For example, to read a Windows file, you need to write:

// Create new state:
state = smbclient_state_new();
// Initialize the state with workgroup, username and password:
smbclient_state_init($state, null, 'testuser', 'password');
// Open a file for reading:
$file = smbclient_open($state, 'smb://server/testshare/file.txt', 'r');
if ($file) {
  // Read the file incrementally, dump contents to output:
  while ($data = smbclient_read($state, $file, 1000)) {
    echo $data;
  }
}
// Close the file handle:
smbclient_close($state, $file); 
// Free the state
smbclient_state_free($state);

 

Not fun ;) of course it's possible to create a streamWrapper to make its use more simple, such as the one provided by icewin/smb.

So I start to contribute to this project to improve it:

So, previous example can be written more simply:

readfile("smb://testuser:password@server/testshare/file.txt");

Some more work are still on their way:

In the future, it could also be interesting to switch from resource to object (e.g; SmbClient\State, SmbClient\File, SmbClient\Dir).

Of course, RPM of php-libsmbclient are available in my repository, version 0.7.0 in remi, remi-php55 and remi-php56 and version 0.8.0-dev in remi-test and remi-php70.

Test and feedback are very welcome.