the following remote storage are supported in this library:
AWS S3 Bucket
✅SFTP file server
🛠
I used the
MinIO
docker instead of AWS S3 for local testing
Symfony + AWS S3 Demo: List, download, delete, upload file object in Symfony5 Demo
git clone https://github.com/SchwarzIT/php-remote-storage.git storage && cd storage
make install
make test
http://localhost:9001/ for
MinIO
bucket (the credentials are test data for local env.)
- Access-Key:
I3uWTHZGke8RWa1j
- secret-Key:
G0OC3OYQ5Qw59z61
// instantiate S3 File system
$S3Adapter = new S3Adapter($s3Client, self::TEST_S3_BUCKET);
// upload a test file
$S3Adapter->save($pngFile);
// delete a test file
$S3Adapter->delete($pdfFile);
// load a test file
$S3Adapter->get($pdfFile);
// @more info see S3AdapterTest.php
config the AWS S3 Client
and S3Adapter
## config/packages/s3.yaml
services:
Aws\S3\S3Client:
arguments:
- region: '%env(S3_REGION)%'
endpoint: '%env(S3_ENDPOINT)%'
version: '2006-03-01'
use_path_style_endpoint: true
credentials:
key: '%env(S3_ACCESS_KEY)%'
secret: '%env(S3_ACCESS_SECRET)%'
Chapterphp\Storage\RemoteStorageInterface: '@Chapterphp\Storage\S3Adapter'
config the services for the package ``
### config/services.yaml
services:
Chapterphp\Storage\S3Adapter:
arguments:
$s3Bucket: '%env(S3_BUCKET)%'