diff --git a/composer.json b/composer.json index 6431520..07e9c10 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "upyun/sdk", + "name": "guoxiangke/upyun-sdk", "description": "UPYUN sdk for php", "keywords": ["UPYUN", "sdk"], "type": "library", @@ -9,7 +9,7 @@ "require": { "php": ">=5.5.0", "ext-curl": "*", - "guzzlehttp/guzzle": "~6.0" + "guzzlehttp/guzzle": "^7.0" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/src/Upyun/Api/Rest.php b/src/Upyun/Api/Rest.php index be4b0a0..53a71a0 100644 --- a/src/Upyun/Api/Rest.php +++ b/src/Upyun/Api/Rest.php @@ -47,7 +47,7 @@ public function request($method, $storagePath) */ public function withFile($file) { - $stream = Psr7\stream_for($file); + $stream = \GuzzleHttp\Psr7\Utils::streamFor($file); $this->file = $stream; return $this; diff --git a/src/Upyun/Uploader.php b/src/Upyun/Uploader.php index 95e6f2f..037b73b 100644 --- a/src/Upyun/Uploader.php +++ b/src/Upyun/Uploader.php @@ -24,7 +24,7 @@ public function __construct(Config $config) public function upload($path, $file, $params, $withAsyncProcess) { - $stream = Psr7\stream_for($file); + $stream = \GuzzleHttp\Psr7\Utils::streamFor($file); $size = $stream->getSize(); $useBlock = $this->needUseBlock($size); @@ -87,7 +87,7 @@ private function pointUpload($path, $stream, $params) 'X-Upyun-Multi-Uuid' => $uuid, 'X-Upyun-Part-Id' => $partId )) - ->withFile(Psr7\stream_for($fileBlock)) + ->withFile(\GuzzleHttp\Psr7\Utils::streamFor($fileBlock)) ->send(); if ($res->getStatusCode() !== 204) { @@ -167,7 +167,7 @@ private function concurrentPointUpload($path, $stream, $params) 'X-Upyun-Multi-Uuid' => $uuid, 'X-Upyun-Part-Id' => $i )) - ->withFile(Psr7\stream_for($fileBlock)) + ->withFile(\GuzzleHttp\Psr7\Utils::streamFor($fileBlock)) ->toRequest(); } }; diff --git a/src/Upyun/Upyun.php b/src/Upyun/Upyun.php index e74c6c7..40c5ee3 100644 --- a/src/Upyun/Upyun.php +++ b/src/Upyun/Upyun.php @@ -154,7 +154,7 @@ public function read($path, $saveHandler = null, $params = array()) if (! isset($params['x-upyun-list-iter'])) { if (is_resource($saveHandler)) { - Psr7\copy_to_stream($response->getBody(), Psr7\stream_for($saveHandler)); + Psr7\copy_to_stream($response->getBody(), \GuzzleHttp\Psr7\Utils::streamFor($saveHandler)); return true; } else { return $response->getBody()->getContents();