This repository provides MinIO add-on to DDEV.
It's based on MinIO official image and DDEV custom compose files
$ ddev get ddev/ddev-minio
$ ddev restart
Login to MinIO console https://<project>.ddev.site:9090
login with credentials ddevminio:ddevminio
and create a bucket.
Project docker instances can access MinIO api via http://minio:10101
DDEV Router is configured to proxy the requests to https://<project>.ddev.site:10101
to MinIO S3 Api.
Example URLs for accessing files are
Bucket | File path | Internal URL | External URL |
---|---|---|---|
photos |
vacation/seaside.jpg |
http://minio:10101/photos/vacation/seaside.jpg |
https://<project>.ddev.site:10101/photos/vacation/seaside.jpg |
music |
tron/derezzed.mp3 |
http://minio:10101/music/tron/derezzed.mp3 |
https://<project>.ddev.site:10101/music/tron/derezzed.mp3 |
Since MinIO is S3 compatible you can use AWS PHP SDK. Install it with composer:
$ ddev composer require aws/aws-sdk-php
<?php
require __DIR__ . '/vendor/autoload.php';
$s3 = new \Aws\S3\S3Client([
'endpoint' => 'http://minio:10101',
'credentials' => [
'key' => 'ddevminio',
'secret' => 'ddevminio',
],
'region' => 'us-east-1',
'version' => 'latest',
'use_path_style_endpoint' => true,
]);
$bucketName = 'ddev-minio';
if (!$s3->doesBucketExist($bucketName)) {
$s3->createBucket([
'Bucket' => $bucketName,
]);
}
$s3->putObject([
'Bucket' => $bucketName,
'Key' => 'ddev-test',
'Body' => 'DDEV Minio is working!',
]);
$object = $s3->getObject([
'Bucket' => $bucketName,
'Key' => 'ddev-test',
]);
echo $object['Body'];
Addon exposes the following commands
Command | Usage | Description |
---|---|---|
minio |
ddev minio |
Launches the MinIO Console |
mc |
ddev mc |
Launches the MinIo admin client |
Based on the original ddev-contrib recipe
Developed and maintained by Oblak Studio