From ed20b421e408722b492f9b856a720dbe7825fa2c Mon Sep 17 00:00:00 2001 From: Kendrick Chan Date: Mon, 22 Mar 2021 11:02:56 +0800 Subject: [PATCH] Add azure blob libraries and proof of concept #540 --- composer.json | 1 + composer.lock | 96 +++++++++++++++++++++++++++++++++++-- symfony.lock | 6 +++ utils/test_azure/output.txt | 11 +++++ utils/test_azure/test.php | 39 +++++++++++++++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 utils/test_azure/output.txt create mode 100644 utils/test_azure/test.php diff --git a/composer.json b/composer.json index d2f81e89..20b9c833 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "data-dog/audit-bundle": "^0.1.10", "edwinhoksberg/php-fcm": "^1.0", "guzzlehttp/guzzle": "^6.3", + "microsoft/azure-storage-blob": "^1.5", "predis/predis": "^1.1", "sensio/framework-extra-bundle": "^5.1", "setasign/fpdf": "^1.8", diff --git a/composer.lock b/composer.lock index 1e76e914..6f8cb6bb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f03b92d48946e8b2ee19466f931c826f", + "content-hash": "ad9d56a6dff26742f024917e58b919f9", "packages": [ { "name": "catalyst/auth-bundle", @@ -944,6 +944,7 @@ "cache", "caching" ], + "abandoned": true, "time": "2019-11-29T11:22:01+00:00" }, { @@ -1611,6 +1612,7 @@ "reflection", "static" ], + "abandoned": "roave/better-reflection", "time": "2020-03-27T11:06:43+00:00" }, { @@ -1901,6 +1903,94 @@ ], "time": "2014-01-12T16:20:24+00:00" }, + { + "name": "microsoft/azure-storage-blob", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-blob-php.git", + "reference": "2475330963372d519387cb8135d6a9cfd42272da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/2475330963372d519387cb8135d6a9cfd42272da", + "reference": "2475330963372d519387cb8135d6a9cfd42272da", + "shasum": "" + }, + "require": { + "microsoft/azure-storage-common": "~1.5", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Blob\\": "src/Blob" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.", + "keywords": [ + "azure", + "blob", + "php", + "sdk", + "storage" + ], + "time": "2020-12-29T02:22:11+00:00" + }, + { + "name": "microsoft/azure-storage-common", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-common-php.git", + "reference": "e5738035891546075bd369954e8af121d65ebd6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/e5738035891546075bd369954e8af121d65ebd6d", + "reference": "e5738035891546075bd369954e8af121d65ebd6d", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "~6.0|^7.0", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Common\\": "src/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", + "keywords": [ + "azure", + "common", + "php", + "sdk", + "storage" + ], + "time": "2020-12-28T07:59:51+00:00" + }, { "name": "nikic/php-parser", "version": "v4.3.0", @@ -2078,12 +2168,12 @@ "version": "v1.1.1", "source": { "type": "git", - "url": "https://github.com/nrk/predis.git", + "url": "https://github.com/predis/predis.git", "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", + "url": "https://api.github.com/repos/predis/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", "shasum": "" }, diff --git a/symfony.lock b/symfony.lock index 900434cc..c699229c 100644 --- a/symfony.lock +++ b/symfony.lock @@ -113,6 +113,12 @@ "jdorn/sql-formatter": { "version": "v1.2.17" }, + "microsoft/azure-storage-blob": { + "version": "1.5.2" + }, + "microsoft/azure-storage-common": { + "version": "1.5.1" + }, "nikic/php-parser": { "version": "v4.1.0" }, diff --git a/utils/test_azure/output.txt b/utils/test_azure/output.txt new file mode 100644 index 00000000..d4e17cec --- /dev/null +++ b/utils/test_azure/output.txt @@ -0,0 +1,11 @@ +DispatcheDate,Sku,SerialNumber +2020-08-07 05:32:04.537,WMGL23DL-CPNMB-L,MGS706202004 +2020-08-07 05:32:04.537,WMGL23DL-CPNMB-L,MGS706202005 +2020-08-07 05:32:04.537,WMGL23DL-CPNMB-L,MGS706202006 +2020-08-08 09:27:14.480,WMXX26EL-CPN00-LX,MXS808202001 +2020-08-08 09:31:48.737,WMXX26EL-CPN00-LX,MXS808202002 +2020-08-08 10:27:08.117,WMXX26EL-CPN00-LX,MXS808202003 +2020-08-08 10:41:10.060,WMXX26EL-CPN00-LX,MXS808202004 +2020-08-08 10:41:10.060,WMXX26EL-CPN00-LX,MXS808202005 +2020-08-08 10:41:10.060,WMXX26EL-CPN00-LX,MXS808202006 +2020-10-05 13:53:57.000,ECHD26AL-SPN00-LX,CH2000012625 diff --git a/utils/test_azure/test.php b/utils/test_azure/test.php new file mode 100644 index 00000000..e03c6f1f --- /dev/null +++ b/utils/test_azure/test.php @@ -0,0 +1,39 @@ +getBlob('warranty', 'Sample Result.csv'); +// print_r($res); + +file_put_contents("output.txt", $res->getContentStream()); + + +/* +// NOTE: getting via url +echo $blob_client->getPsrPrimaryUri() . "\n"; + +$url = $blob_client->getPsrPrimaryUri() . '?' . $sas_token; +$url = $blob_url . '?' . $sas_token; +file_put_contents('output.txt', fopen($url, 'r')); +*/ + + +