承接 aws/aws-sdk-php-laravel5 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aws/aws-sdk-php-laravel5

最新稳定版本:1.1.1

Composer 安装命令:

composer require aws/aws-sdk-php-laravel5

包简介

A simple Laravel 4/5 service provider for including the AWS SDK for PHP.

README 文档

README

Latest Stable Version Total Downloads

A simple Laravel 5 service provider for including the AWS SDK for PHP.

Installation

The AWS Service Provider can be installed via Composer by requiring the aws/aws-sdk-php-laravel5 package in your project's composer.json.

{
    "require": {
        "aws/aws-sdk-php-laravel5": "1.*"
    }
}

Then run a composer update

php composer.phar update

Configuration

To use the AWS Service Provider, you must register the provider when bootstrapping your Laravel application.

Publish the package configuration using Artisan.

php artisan config:publish aws/aws-sdk-php-laravel5

Update your settings in the generated app/config/packages/aws/aws-sdk-php-laravel5 configuration file.

return array(
    'key'         => 'YOUR_AWS_ACCESS_KEY_ID',
    'secret'      => 'YOUR_AWS_SECRET_KEY',
    'region'      => 'us-east-1',
    'config_file' => null,
);

Find the providers key in your app/config/app.php and register the AWS Service Provider.

    'providers' => array(
        // ...
        'Aws\Laravel\AwsServiceProvider',
    )

Find the aliases key in your app/config/app.php and add the AWS facade alias.

    'aliases' => array(
        // ...
        'AWS' => 'Aws\Laravel\AwsFacade',
    )

Usage

In order to use the AWS SDK for PHP within your app, you need to retrieve it from the Laravel IoC Container. The following example uses the Amazon S3 client to upload a file.

$s3 = App::make('aws')->get('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

If the AWS facade is registered within the aliases section of the application configuration, you can also use the following technique.

$s3 = AWS::get('s3');
$s3->putObject(array(
    'Bucket'     => 'YOUR_BUCKET',
    'Key'        => 'YOUR_OBJECT_KEY',
    'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext',
));

Links

统计信息

  • 总下载量: 329
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 80
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-12-04