Ini adalah komponen sisi server untuk akses ke MinIO.
Bucket (check, create, policy)
Folder (create)
File (upload, delete, check)
Get Pre-Signed URL (private file)
composer require humaninitiative/yii2-minio-component:"dev-master"Tambahkan pada .env :
MINIO_REGION={region}
MINIO_ENDPOINT={endpoint url}
MINIO_KEY={user key}
MINIO_SECRET={user secret pass}
MINIO_DEFAULT_BUCKET={default bucket}
Lalu tambahkan pada config/web.php :
'components' => [
'minio' => [
'class' => 'humaninitiative\s3\MinioComponent',
'version' => 'latest',
'use_path_style_endpoint' => true,
'region' => $_ENV['MINIO_REGION'],
'endpoint' => $_ENV['MINIO_ENDPOINT'],
'credentials' => [
'key' => $_ENV['MINIO_KEY'],
'secret' => $_ENV['MINIO_SECRET'],
],
'bucket' => $_ENV['MINIO_DEFAULT_BUCKET'],
],
],
Copy FileController.php ke modules/api/controllers :
cp vendor/humaninitiative/yii2-minio-component/src/FileController.php modules/api/controllers/
Ubah namespace menjadi app\modules\api\controllers.