Skip to content
これは pieceofcake2/aws のドキュメントです。pieceofcake2/cakephp 用の CakePHP 2.x プラグインです。 このフォークについて

S3 ストリームラッパー ​

S3 ストリームラッパーを使うと、PHP のファイル関数 (file_get_contents()、file_put_contents()、 fopen()、is_file() など) で s3://bucket/key パスを扱えます。

'bootstrap' => true でプラグインを読み込むと、Aws の設定でストリームラッパーが登録されます。 自分で登録することもできます。

php
use Aws\S3\S3Client;

$client = new S3Client(Configure::read('Aws'));
$client->registerStreamWrapperV2();

登録後は次のように使えます。

php
file_put_contents('s3://my-bucket/reports/today.csv', $csv);
$csv = file_get_contents('s3://my-bucket/reports/today.csv');

著作権とライセンスについては LICENSE を参照してください。Cake Software Foundation とは関係ありません。