Aws Sdk Php Laravel
Aws Sdk Php Laravel stats
- Downloads
- 20.4M
- Stars
- 1,590
- Open Issues
- 9
- Forks
- 283
A simple Laravel 5/6/7/8/9 service provider for including the AWS SDK for PHP.
AWS SDK PHP Laravel Package Summary
The AWS SDK PHP Laravel package provides a simple and efficient way to integrate the AWS SDK into Laravel and Lumen applications, supporting a wide range of Laravel versions from 5.1 to 10.0. The package offers a Laravel service provider to include the official AWS SDK for PHP, simplifying the interaction with AWS services.
Key Features
- Compatibility: Supports Laravel versions 5.1 to 10.0.
- Ease of Installation: Can be installed via Composer.
- Automatic Configuration: Utilizes environment variables for hassle-free setup.
- Facilitates AWS Service Operations: Simplifies tasks like uploading files to S3 using Laravel's service container or the AWS facade.
Installation
Install the package using Composer:
composer require aws/aws-sdk-php-laravel:~3.0
For Laravel, add the service provider and facade alias in config/app.php:
'providers' => [ Aws\Laravel\AwsServiceProvider::class, // other providers]; 'aliases' => [ 'AWS' => Aws\Laravel\AwsFacade::class, // other aliases];
For Lumen, register the service provider in bootstrap/app.php:
$app->register(Aws\Laravel\AwsServiceProvider::class);
Configuration
The package uses three main environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION. To customize these settings, publish the configuration file:
php artisan vendor:publish --provider="Aws\Laravel\AwsServiceProvider"
Modify the settings in the published config/aws.php.
Usage
Retrieve the AWS client from the Laravel service container and perform operations like:
$s3 = App::make('aws')->createClient('s3');$s3->putObject([ 'Bucket' => 'YOUR_BUCKET', 'Key' => 'YOUR_OBJECT_KEY', 'SourceFile' => '/path/to/your/file.ext',]);
Or use the AWS facade:
$s3 = AWS::createClient('s3');$s3->putObject([...]);
Getting Help
For support, you can ask questions on StackOverflow with the aws-php-sdk tag, join the AWS SDK for PHP Gitter community, or open a support ticket with AWS Support. For bugs and feature requests, open an issue on the GitHub repository.
Contributing
Contributions are welcome. Review the contributing guidelines before submitting issues or pull requests.
This package is a practical choice for Laravel developers looking to leverage AWS services effectively, providing a robust toolset facilitated by the AWS SDK for PHP.