Skip to content

Coderlab/aws-sdk-php-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Service Provider for Laravel 4

A simple Laravel 4 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-laravel package and setting the minimum-stability to dev (required for Laravel 4) in your project's composer.json.

{
    "require": {
        "aws/aws-sdk-php-laravel": "1.*"
    },
    "minimum-stability": "dev"
}

Usage

First you have to register the AWS Service Provider when bootstrap your Laravel application. You can either provide an array of configuration options…

use Aws\Common\Enum\Region;
use Aws\Laravel\AwsServiceProvider;
use Illuminate\Foundation\Application;

$app = new Application();
// ...

$app->register(new AwsServiceProvider($app), array(
    'config' => array(
        'aws' => array(
            'key'    => '<your-aws-access-key-id>',
            'secret' => '<your-aws-secret-access-key>',
            'region' => Region::US_WEST_2,
        ),
    ),
));

Or you can specify the path to an AWS config file (see AWS SDK for PHP for details).

$app->register(new AwsServiceProvider($app), array('config' => array('aws' => '/path/to/aws/config/file.php')));

Either way, the value of $app['config']['aws'] is passed directly into Aws\Common\Aws::factory().

In order to use the SDK from within your app, you need to retrieve it from the Laravel IoC Container.

$s3 = App::make('aws')->get('s3');
$s3->putObject(array(
    'Bucket'     => '<your-bucket>',
    'Key'        => 'the-name-of-your-object',
    'SourceFile' => '/path/to/the/file/you/are/uploading.ext',
));

Links

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy