Skip to main content

How to use the AWS SDK for Laravel with Stook?

To use the Laravel SDK, follow the steps below.

  • Install the AWS SDK for Laravel.

  • Register package to your application

  • Configure AWS profiles for the Stook account using the Stook keys.


You can use the composer to install the AWS SDK for your Laravel application

composer require aws/aws-sdk-php-laravel

Package Registration

After installation, you must register the package usage for your application via the config/app.php

'providers' => [

        // ...


 'aliases' => [

        // ...

        'AWS' => Aws\Laravel\AwsFacade::class,


Stook Configuration

Run vendor publish command on your terminal. This command will create config/aws.php file. You can use this file to configure your stook account with your application

php artisan vendor:publish —provider="Aws\Laravel\AwsServiceProvider"

After publish, edit the config/aws.php.

return [

    'credentials' => [

        'key'    => env(‘YOUR_STOOK_ACCESS_KEY_ID'),

        'secret' => env(‘YOUR_STOOK_SECRET_ACCESS_KEY'),


    'region' => env('YOUR_STOOK_REGION', 'us-east-1'),

    'version' => 'latest',

    'ua_append' => [

        'L5MOD/' . AwsServiceProvider::VERSION,


    'endpoint' => env('YOUR_STOOK_ENDPOINT'),

    'use_path_style_endpoint' => true,

    'http'    => [

        'verify' => false



You must define your ENV variables via the .env file.

public function uploadStookFile(Request $request)
    // File Informations
    $fileExtension = $request->file(‘image')
    $fileFullName = "testFile". '.' . $fileExtension;

    // Try upload file to Stook
    try {
        $s3 = App::make('aws')->createClient('s3');
            'Bucket'     => "test-bucket",
            'Key'        => $fileFullName,
            'SourceFile' => $request->file('image')->getRealPath(),
    }catch (\Exception $exception){
        throw new \Exception('File could not upload to stook account.');

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.