https://github.com/thephpleague/flysystem
https://flysystem.thephpleague.com/docs/adapter/aws-s3/
https://github.com/thephpleague/flysystem-aws-s3-v3/issues/127
| <?php | |
| class FileManager | |
| { | |
| const USER_FOLDER = siteData()->userFolder; | |
| protected $adapter; | |
| public function __construct($adapter) | |
| { | |
| $this->adapter = $adapter; | |
| } | |
| } | |
| $fileManager = new FileManager(new App\Libraries\FileManager\Adapters\DOSpaces()); | |
| $fileManager->init(); |
| <?php | |
| use Aws\S3\S3Client; | |
| use League\Flysystem\AwsS3v3\AwsS3Adapter; | |
| use League\Flysystem\Filesystem; | |
| include __DIR__.'/vendor/autoload.php'; | |
| $client = new S3Client([ | |
| 'endpoint' => 'https://nyc3.digitaloceanspaces.com', | |
| 'version' => 'latest', | |
| 'credentials' => [ | |
| 'key' => 'KEY', | |
| 'secret' => 'SECRET' | |
| ], | |
| 'region' => 'nyc3', | |
| ]); | |
| $adapter = new AwsS3Adapter($client, 'flysystem-test'); | |
| $filesystem = new Filesystem($adapter); | |
| print_r($filesystem->listContents()); |