Matomo Analytics

First of all install a new storage server, you can select this when pressing "Create server" under "Type", you will be able to select "Storage server" there.

Next in your Laravel application, add the Amazon S3 driver:

composer require league/flysystem-aws-s3-v3

Next we have to configure a new filesystem driver inside the config file: config/filesystems.php, open this file in your favorite IDE.

Look up the disks array in this file and add the following block to that array:

'minio' => [
    'driver' => 's3',
    'endpoint' => env('MINIO_ENDPOINT', 'http://127.0.0.1:9000'),
    'use_path_style_endpoint' => true,
    'key' => env('MINIO_KEY'),
    'secret' => env('MINIO_SECRET'),
    'region' => env('MINIO_REGION'),
    'bucket' => env('MINIO_BUCKET'),
],

Then we have to add those values to our .env file:

FILESYSTEM_CLOUD=minio
MINIO_ENDPOINT=http://127.0.0.1:9000
MINIO_KEY=YOUR-ACCESS-KEY
MINIO_SECRET=YOUR-SECRET-KEY
MINIO_REGION=us-east-1
MINIO_BUCKET=test

The value for MINIO_REGION can be anything you want as this is not used for MinIO. 
The value for MINIO_BUCKET is the name of the bucket you have created in the storage server.

You are now ready to start using your storage server, here is an example to get all files from your storage:

Route::get('storage', function(){
    return Storage::disk('minio')->files();
});

More information about the Laravel storage system can be found in their documentation.

14 November 2019 (last updated 4 years ago)

8273 views

Written by Dennis

Dennis brings over 6 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Back to Storage server


Start free trial