chella / aws-services
amazon service tnq
v0.0.1
2021-10-19 11:42 UTC
Requires
- aws/aws-sdk-php: ^3.87
README
Application with Slim Framework
Installation
Use Composer
Do Composer Require as below
composer require chella/aws-services
Setup S3
try {
$s3 = App::get("fileSystemS3", [
"key"=>"###",
"secret" => "###",
"bucket" => "###",
"region" => "###"
]);
}
catch (Exception $e) {
echo $e->getMessage() . "\n";
}
Setup Minio
try {
$minio = App::get("minioFileSystem", [
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'http://localhost:9000',
'use_path_style_endpoint' => true,
'credentials' => [
'key' => '###',
'secret' => '###',
],
'bucket' => '###',
]);
## for writing content over minio server
## 1st arg is filename
## 2nd arg is content
$minio->write('sample.txt', 'hello minio test');
## for read content over minio server
## 1st arg is filename
echo $minio->read('sample.txt');
## for delete content over minio server
## 1st arg is filename
echo $minio->delete('sample.txt');
}
catch (Exception $e) {
echo $e->getMessage() . "\n";
}
Minio docker documentation
https://registry.hub.docker.com/r/minio/minio/
docker run command
docker run -e MINIO_ROOT_USER=admin -e MINIO_ROOT_PASSWORD=chella#321 -p 9000:9000 -p 9001:9001 --name cloudS3local minio/minio server /data --console-address ":9001"
Here you go
Happy coding.