jplarar/s3-bundle

一个简单的用于AWS S3 API的Symfony2扩展包。

安装次数: 1,265

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

公开问题: 0

类型:symfony-bundle

1.4.8 2023-06-16 00:16 UTC

This package is auto-updated.

Last update: 2024-09-16 03:11:51 UTC


README

一个简单的用于AWS S3 API的Symfony2扩展包。

设置

步骤 1: 使用composer下载JplararS3Bundle

在composer.json中添加S3 Bundle

{
    "require": {
        "jplarar/s3-bundle": "dev-master"
    }
}

现在运行命令让composer下载扩展包

$ php composer.phar update "jplarar/s3-bundle"

步骤 2: 启用扩展包

在kernel中启用扩展包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Jplarar\S3Bundle\JplararS3Bundle()
    );
}

步骤 3: 添加配置

# app/config/config.yml
jplarar_s3:
        amazon_s3:
            amazon_s3_key:    %amazon_s3_key%
            amazon_s3_secret: %amazon_s3_secret%
            amazon_s3_bucket: %amazon_s3_bucket%
            amazon_s3_region: %amazon_s3_region%

使用方法

使用服务

<?php
        $s3Client = $this->get('amazon_s3_client');
?>

##示例

###上传新文件到S3

<?php 
    $s3Client->write($key, $content, $mimeType);
?>