duellsy/aws-sdk-php-laravel
Composer 安装命令:
composer require duellsy/aws-sdk-php-laravel
包简介
A simple Laravel 5/6/7/8 service provider for including the AWS SDK for PHP.
README 文档
README
This is a simple Laravel service provider for making it easy to include the official AWS SDK for PHP in your Laravel and Lumen applications.
This README is for version 3.x of the service provider, which is implemented to work with Version 3 of the AWS SDK for PHP and Laravel 5.1.
Major Versions:
- 3.x (YOU ARE HERE) - For
laravel/framework:~5.1|~6.0|~7.0|~8.0andaws/aws-sdk-php:~3.0 - 2.x (2.0 branch) - For
laravel/framework:5.0.*andaws/aws-sdk-php:~2.4 - 1.x (1.0 branch) - For
laravel/framework:4.*andaws/aws-sdk-php:~2.4
Jump To:
Getting Started
Installation
The AWS Service Provider can be installed via Composer by requiring the
aws/aws-sdk-php-laravel package in your project's composer.json.
{
"require": {
"aws/aws-sdk-php-laravel": "~3.0"
}
}
Then run a composer update
php composer.phar update
To use the AWS Service Provider, you must register the provider when bootstrapping your application.
Lumen
In Lumen find the Register Service Providers in your bootstrap/app.php and register the AWS Service Provider.
$app->register(Aws\Laravel\AwsServiceProvider::class);
Laravel
In Laravel find the providers key in your config/app.php and register the AWS Service Provider.
'providers' => array( // ... Aws\Laravel\AwsServiceProvider::class, )
Find the aliases key in your config/app.php and add the AWS facade alias.
'aliases' => array( // ... 'AWS' => Aws\Laravel\AwsFacade::class, )
Configuration
By default, the package uses the following environment variables to auto-configure the plugin without modification:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION (default = us-east-1)
To customize the configuration file, publish the package configuration using Artisan.
php artisan vendor:publish --provider="Aws\Laravel\AwsServiceProvider"
The settings can be found in the generated config/aws.php configuration file. By default, the credentials and region settings will pull from your .env file.
return [ 'credentials' => [ 'key' => env('AWS_ACCESS_KEY_ID', ''), 'secret' => env('AWS_SECRET_ACCESS_KEY', ''), ], 'region' => env('AWS_REGION', 'us-east-1'), 'version' => 'latest', // You can override settings for specific services 'Ses' => [ 'region' => 'us-east-1', ], ];
Note that you can always delete the credentials line from this file if you'd like to use the default SDK Configuration Provider chain instead.
Referring Laravel 5.2.0 Upgrade guide, you must using config
file instead of environment variable option if using php artisan config:cache.
Learn more about configuring the SDK on the SDK's User Guide.
Usage
In order to use the AWS SDK for PHP within your app, you need to retrieve it from the Laravel Service Container. The following example uses the Amazon S3 client to upload a file.
$s3 = App::make('aws')->createClient('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::createClient('s3'); $s3->putObject(array( 'Bucket' => 'YOUR_BUCKET', 'Key' => 'YOUR_OBJECT_KEY', 'SourceFile' => '/the/path/to/the/file/you/are/uploading.ext', ));
Getting Help
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
- Ask a question on StackOverflow and tag it with
aws-php-sdk - Come join the AWS SDK for PHP gitter
- Open a support ticket with AWS Support
- If it turns out that you may have found a bug, please open an issue
This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the Amazon Web Services Discussion Forums.
Opening Issues
If you encounter a bug with aws-sdk-php-laravel we would like to hear about it. Search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. It’s helpful if you include the version of aws-sdk-php-laravel, PHP version and OS you’re using. Please include a stack trace and reduced repro case when appropriate, too.
The GitHub issues are intended for bug reports and feature requests. For help and questions with using aws-sdk-php please make use of the resources listed in the Getting Help section. There are limited resources available for handling issues and by keeping the list of open issues lean we can respond in a timely manner.
Contributing
We work hard to provide a high-quality and useful SDK for our AWS services, and we greatly value feedback and contributions from our community. Please review our contributing guidelines before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
Resources
duellsy/aws-sdk-php-laravel 适用场景与选型建议
duellsy/aws-sdk-php-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 618 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「amazon」 「s3」 「sdk」 「aws」 「dynamodb」 「ec2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 duellsy/aws-sdk-php-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 duellsy/aws-sdk-php-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 duellsy/aws-sdk-php-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
simple api library.
A replica of the AWS Elastic Beanstalk worker SQS daemon (sqsd) in PHP
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
A beautiful, zero-dependency UI for querying and viewing AWS CloudWatch logs directly inside your Laravel application.
统计信息
- 总下载量: 618
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-02-11