jovanialferez/yii2-s3

作为 Yii2 组件的 Amazon S3Client 包装器

1.0 2015-04-23 01:29 UTC

This package is not auto-updated.

Last update: 2024-09-25 12:32:44 UTC


README

作为 Yii2 组件的 Amazon S3Client 包装器。

使用方法

return [
	// ...
	'components' => [
		'storage' => [
			'class' => '\jovanialferez\yii2s3\AmazonS3',
			'key' => 'AWS_ACCESS_KEY_ID',
			'secret' => 'AWS_SECRET_ACCESS_KEY',
			'bucket' => 'YOUR_BUCKET',
		],
		// ...
	],
];

您可以使用此组件作为

$storage = \Yii::$app->storage;

// uploadFile() here returns the resulting S3 url of that file
$url = $storage->uploadFile('/path/to/file', 'unique_file_name');