--- title: "Laravel With Wasabi" slug: "how-do-i-use-laravel-with-wasabi" updated: 2026-09-17T18:04:56Z published: 2026-09-17T18:04:56Z canonical: "docs.wasabi.com/how-do-i-use-laravel-with-wasabi" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.wasabi.com/llms.txt > Use this file to discover all available pages before exploring further. # Laravel With Wasabi [Laravel](https://laravel.com/) is validated for use with Wasabi. To use this product with Wasabi, follow the instructions below. 1. Set up Wasabi account and create bucket as described [here.](https://docs.wasabi.com/docs/how-easy-is-it-to-get-started-with-wasabi) 2. Create IAM user with appropriate permissions attached to the user for performing required action(s). Policy can be generated using tools such as [AWS Policy Generator](https://awspolicygen.s3.amazonaws.com/policygen.html) 3. Create API keys for your user using the console, and save this credential file so you can later use the API keys in the code 4. Install Composer using the CLI as described [here](https://www.hostinger.com/tutorials/how-to-install-composer)). 5. Create a new Laravel Project using the following command, and you will receive the following output on the terminal once this is successfully created ```plaintext composer create-project laravel/laravel ``` ![Screen_Shot_2019-10-30_at_4.23.35_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_4.png) 1. Go inside your project using cd command, and you will see the project files inside ![Screen_Shot_2019-10-30_at_4.28.00_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_4(1).png) 1. Edit certain files inside this project to make this work with S3 style storage. You can use any editor (for example, vim or nano) or an IDE (for example, Atom or Visual Studio Code) to easily search for and edit them. 2. Once you have the framework open in an IDE, create a new PHP file in resources/views named **fileUpload.blade.php**. Note: Wasabi recommends using the same name for the test as the name you referenced in other files. The hierarchy would appear as follows. ![Screen_Shot_2019-10-30_at_4.35.28_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_4(2).png) Paste the code below in the fileUpload.blade.php file. ```plaintext @extends('layouts.app') @section('content')
File Upload
@csrf
@endsection ``` 1. Go to routes and the web.php file. Replace the file with the following code. ```plaintext Route::get('/', function () { return view('fileUpload'); }); Route::post('upload',function(){ request()->file('file')->store( 'my-file', 'Wasabi' ); })->name('upload'); Auth::routes(); Route::get('/home', 'HomeController@index')->name('home'); ``` Note: The directory in this example my-file, and your files will be uploaded into it. **Wasabi** is being used as the driver, which you will configure later in filesystems.php to specify your custom driver for passing user input. 1. Go to the vendor and the ENV file. Replace the file with the following code. **NOTE**: Make sure to use your correct Access key, Secret Access key, Wasabi bucket region, Wasabi Bucket Name, Wasabi Region URL ```plaintext APP_NAME=Laravel APP_ENV=local APP_KEY=base64:ZBWX+Pgx8ABy8CThdSi9ixRCyQmKQ1iWDsv1TSCMBUM= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD= BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" WAS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX WAS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX WAS_DEFAULT_REGION=us-east-1 WAS_BUCKET=Bucket-Name WAS_URL=s3.wasabisys.com ``` Note that this example uses Wasabi’s us-east-1 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this [article](https://docs.wasabi.com/docs/what-are-the-service-urls-for-wasabis-different-storage-regions). 1. Now you need to create a new driver as s3 has amazonaws.com hardcoded in the library. Go to config, then "filesystems.php" and replace it with the following code ```plaintext return [ 'default' => env('FILESYSTEM_DRIVER', 'local'), 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 'Wasabi' => [ 'driver' => 's3', 'key' => env('WAS_ACCESS_KEY_ID'), 'secret' => env('WAS_SECRET_ACCESS_KEY'), 'region' => env('WAS_DEFAULT_REGION'), 'bucket' => env('WAS_BUCKET'), 'endpoint' => 'https://s3.wasabisys.com' ], ], ]; ``` 1. As the Wasabi/S3 driver is not the default driver for uploading in Laravel, we need a Composer Package to make this work. You can get this package on the Laravel website, as shown below. ![Screen_Shot_2019-10-30_at_5.11.08_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_5.png) Now, on the CLI, go inside your Laravel project and type the following two commands: ```plaintext php artisan make:auth ``` ```plaintext composer require league/flysystem-aws-s3-v3 ``` Output ![Screen_Shot_2019-10-30_at_5.17.28_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_5(1).png) 1. Run your code using the following command, and the server will start listening on port 8000. ```plaintext php artisan serve ``` Output: ![Screen_Shot_2019-10-30_at_5.18.52_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_5(2).png) On the browser, type [http://127.0.0.1:8000](http://127.0.0.1:8000) , and you will be prompted to upload files to your Wasabi Bucket, and once submitted, your files will be visible inside bucket ![Screen_Shot_2019-10-30_at_5.23.01_AM.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/screen_shot_2019-10-30_at_5(3).png) ![mceclip0.png](https://cdn.document360.io/bef0a1ea-7768-4d5a-b520-c4fe2f7fafad/Images/Documentation/fmlznzjjesha4pbc3vptqmceclip0.png)