lnc / azure-file-service
File Service for Microsoft Azure SDK for PHP
Installs: 16 447
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/lnc/azure-file-service
Requires
This package is not auto-updated.
Last update: 2025-10-29 15:17:22 UTC
README
File Service for Microsoft Azure SDK for PHP
Getting Started
##Install via Composer
- Create a file named composer.json in the root of your project and add the following code to it:
{
  "require": {
    "lnc/azure-file-service": "^0"
  },
  "repositories":      [
    {
      "type": "pear",
      "url":  "http://pear.php.net"
    }
  ],
  "minimum-stability": "dev"
}
Usage
Getting Started
<?php
    require_once __DIR__ . '/vendor/autoload.php';
    use WindowsFileService\Common\ServicesBuilder;
    use WindowsFileService\Facade;
    $accountName = '';
    $accountKey  = '';
    $isSecure    = true;
    $connectionString = sprintf(
            'DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s',
            $isSecure
                    ? 'https'
                    : 'http',
            $accountName,
            $accountKey
    );
    
### USING FACADE    
    
    $result = new Facade( $connectionString );
    $result->uploadFile(
           'test',
           'test',
           'test.dat',
           '/home/test.dat'
    );
    
### DIRECTLY            
    $fileRestProxy = ServicesBuilder::getInstance()
                                    ->createFileService( $connectionString );
    $result = $fileRestProxy->createShare(
                                'test'
    );
    
    $result = $fileRestProxy->createDirectory(
                                'test',
                                'test'
    );
        
    $result = $fileRestProxy->createFile(
                            'test',
                            'test',
                            'test.txt',
                            4
    );
    
    $result = $fileRestProxy->createFileContents(
                                'test',
                                'test',
                                'test.txt',
                                'test'
    );
    
    OR
    $result = $fileRestProxy->createFileRange(
                            'test',
                            'test',
                            'test.txt',
                            new \WindowsFileService\File\Models\FileRange( 0, 3 ),
                            'test'
    );