-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source code copied from azure-storage-php for v1.0.0-file release
- Loading branch information
Showing
38 changed files
with
8,072 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Tracking Breaking changes in 1.0.0 | ||
|
||
* Removed `dataSerializer` parameter from `FileRextProxy` constructor. | ||
* Option parameter type of `FileRestProxy::CreateFileFromContent` changed and added `setUseTransactionalMD5` method. | ||
* Deprecated PHP 5.5 support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This [repository](https://github.com/azure/azure-storage-file-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
2018.01 - version 1.0.0 | ||
|
||
* Created `FileSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateFileServiceSharedAccessSignatureToken()` into `FileSharedAccessSignatureHelper`. | ||
* Added static builder methods `createFileService` into `FileRestProxy`. | ||
* Removed `dataSerializer` parameter from `FileRextProxy` constructor. | ||
* Added `setUseTransactionalMD5` method for option of `FileRestProxy::CreateFileFromContent`. Default false, enabling transactional MD5 validation will take more cpu and memory resources. | ||
* Deprecated PHP 5.5 support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Copyright (c) 2016 Microsoft Corporation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,150 @@ | ||
# Microsoft Azure Storage File PHP Client Library | ||
|
||
# Contributing | ||
This project provides a PHP client library that makes it easy to access Microsoft Azure Storage file services. For documentation on how to host PHP applications on Microsoft Azure, please see the [Microsoft Azure PHP Developer Center](http://www.windowsazure.com/en-us/develop/php/). | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
[![Latest Stable Version](https://poser.pugx.org/microsoft/azure-storage-file/v/stable)](https://packagist.org/packages/microsoft/azure-storage-file) | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
> **Note** | ||
> | ||
> * This [repository](https://github.com/azure/azure-storage-file-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution. | ||
> * If you are looking for the Service Bus, Service Runtime, Service Management or Media Services libraries, please visit https://github.com/Azure/azure-sdk-for-php. | ||
> * If you need big file (larger than 2GB) or 64-bit integer support, please install PHP 7 64-bit version. | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
# Features | ||
|
||
* Files | ||
* create, list, and delete file shares and directories | ||
* create, delete and download files | ||
|
||
Please check details on [API reference documents](http://azure.github.io/azure-storage-php). | ||
|
||
# Getting Started | ||
## Minimum Requirements | ||
|
||
* PHP 5.6 or above | ||
* See [composer.json](composer.json) for dependencies | ||
* Required extension for PHP: | ||
php_fileinfo.dll | ||
php_mbstring.dll | ||
php_openssl.dll | ||
php_xsl.dll | ||
|
||
* Recommended extension for PHP: | ||
php_curl.dll | ||
|
||
## Download Source Code | ||
|
||
To get the source code from GitHub, type | ||
|
||
git clone https://github.com/Azure/azure-storage-php.git | ||
cd ./azure-storage-php | ||
|
||
|
||
## Install via Composer | ||
|
||
1. Create a file named **composer.json** in the root of your project and add the following code to it: | ||
```json | ||
{ | ||
"require": { | ||
"microsoft/azure-storage-file": "*" | ||
} | ||
} | ||
``` | ||
2. Download **[composer.phar](http://getcomposer.org/composer.phar)** in your project root. | ||
|
||
3. Open a command prompt and execute this in your project root | ||
|
||
php composer.phar install | ||
|
||
## Usage | ||
|
||
There are four basic steps that have to be performed before you can make a call to any Microsoft Azure Storage API when using the libraries. | ||
|
||
* First, include the autoloader script: | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
* Include the namespaces you are going to use. | ||
|
||
To create any Microsoft Azure service client you need to use the rest proxy classes, such as **ListSharesOptions** class: | ||
|
||
use MicrosoftAzure\Storage\File\FileRestProxy; | ||
|
||
To process exceptions you need: | ||
|
||
use MicrosoftAzure\Storage\Common\ServiceException; | ||
|
||
|
||
* To instantiate the service client you will also need a valid [connection string](https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/). The format is: | ||
|
||
DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey] | ||
|
||
or: | ||
|
||
FileEndpoint=[myFileEndpoint];SharedAccessSignature=[sasToken] | ||
|
||
* Instantiate a client object - a wrapper around the available calls for the given service. | ||
|
||
```PHP | ||
$fileClient = FileRestProxy::createFileService($connectionString); | ||
``` | ||
### Using Middlewares | ||
To specify the middlewares, user have to create an array with middlewares | ||
and put it in the `$requestOptions` with key 'middlewares'. The sequence of | ||
the array will affect the sequence in which the middleware is invoked. The | ||
`$requestOptions` can usually be set in the options of an API call, such as | ||
`MicrosoftAzure\Storage\File\Models\ListSharesOptions`. | ||
|
||
The user can push the middleware into the array with key 'middlewares' in | ||
services' `$_options` instead when creating them if the middleware is to be | ||
applied to each of the API call for a rest proxy. These middlewares will always | ||
be invoked after the middlewares in the `$requestOptions`. | ||
e.g.: | ||
``` | ||
$fileClient = ListSharesOptions::createFileService( | ||
$connectionString, | ||
$optionsWithMiddlewares | ||
); | ||
``` | ||
|
||
Each of the middleware should be either an instance of a sub-class that | ||
implements `MicrosoftAzure\Storage\Common\Internal\IMiddleware`, or a | ||
`callable` that follows the Guzzle middleware implementation convention. | ||
|
||
User can create self-defined middleware that inherits from `MicrosoftAzure\Storage\Common\Internal\Middlewares\MiddlewareBase`. | ||
|
||
### Using proxies | ||
To use proxies during HTTP requests, set system variable `HTTP_PROXY` and the proxy will be used. | ||
|
||
## Troubleshooting | ||
### Error: Unable to get local issuer certificate | ||
cURL can't verify the validity of Microsoft certificate when trying to issue a request call to Azure Storage Services. You must configure cURL to use a certificate when issuing https requests by the following steps: | ||
|
||
1. Download the cacert.pem file from [cURL site](http://curl.haxx.se/docs/caextract.html). | ||
2. Open your php.ini file and add the following line: | ||
|
||
``` | ||
curl.cainfo = "<absolute path to cacert.pem>" | ||
``` | ||
## Code samples | ||
You can find samples in the [sample folder](samples) | ||
# Migrate from [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) | ||
If you are using [Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php/) to access Azure Storage Service, we highly recommend you to migrate to this SDK for faster issue resolution and quicker feature implementation. We are working on supporting the latest service features as well as improvement on existing APIs. | ||
For now, Microsoft Azure Storage PHP client libraries share almost the same interface as the storage blobs, tables, queues and files APIs in Azure SDK for PHP. However, there are some minor breaking changes need to be addressed during your migration. You can find the details in [BreakingChanges.md](BreakingChanges.md). | ||
# Need Help? | ||
Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow](http://go.microsoft.com/fwlink/?LinkId=234489) and [github issues](https://github.com/Azure/azure-storage-php/issues) if you have trouble with the provided code. | ||
# Contribute Code or Provide Feedback | ||
If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). | ||
You can find more details for contributing in the [CONTRIBUTING.md](CONTRIBUTING.md). | ||
If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-storage-php/issues) section of the project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "microsoft/azure-storage-file", | ||
"version": "1.0.0", | ||
"description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage File APIs.", | ||
"keywords": [ "php", "azure", "storage", "sdk", "file" ], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Azure Storage PHP Client Library", | ||
"email": "dmsh@microsoft.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.6.0", | ||
"microsoft/azure-storage-common": "~1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"MicrosoftAzure\\Storage\\File\\": "src/File" | ||
} | ||
} | ||
} |
Oops, something went wrong.