Skip to content

Commit dfcc2e6

Browse files
Nyholmjderusse
andauthored
Adding support for AsyncAws (#639)
* Adding support for AsyncAws * Added PHPSpec test * cs * Update doc/adapters/async-aws-s3.md Co-authored-by: Jérémy Derussé <jeremy@derusse.com> * Fixes * cs * cs * Minors * cs * fixes * minor * fix * Update make files Co-authored-by: Jérémy Derussé <jeremy@derusse.com>
1 parent a786092 commit dfcc2e6

File tree

9 files changed

+568
-3
lines changed

9 files changed

+568
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
max-parallel: 10
4343
matrix:
4444
run:
45+
- { php: '7.3', packages: 'async-aws/simple-s3:^0.1.1', phpspec: 'spec/Gaufrette/Adapter/AsyncAwsS3Spec.php' }
4546
- { php: '7.3', packages: 'aws/aws-sdk-php:^2.4.12', phpspec: 'spec/Gaufrette/Adapter/AwsS3Spec.php' }
4647
- { php: '7.4', packages: 'aws/aws-sdk-php:^3.158', phpspec: 'spec/Gaufrette/Adapter/AwsS3Spec.php' }
4748
- { php: '7.4', packages: 'rackspace/php-opencloud:^1.9.2', phpspec: 'spec/Gaufrette/Adapter/OpenCloudSpec.php' }

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ before_install:
3939
- docker exec -it ftpd_server sh -c "(echo ${FTP_PASSWORD}; echo ${FTP_PASSWORD}) | pure-pw useradd ${FTP_USER} -f /etc/pure-ftpd/passwd/pureftpd.passwd -m -u ftpuser -d /home/ftpusers/${FTP_USER}"
4040

4141
install:
42-
- make require-all
42+
- make require-all-legacy
4343
- composer update --prefer-dist --no-progress --no-suggest --ansi
4444

4545
script:

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ php-cs-fix:
3333
docker/run-task php${PHP_VERSION} vendor/bin/php-cs-fixer fix
3434

3535
remove-phpspec:
36+
rm spec/Gaufrette/Adapter/AsyncAwsS3Spec.php
3637
rm spec/Gaufrette/Adapter/AwsS3Spec.php
3738
rm spec/Gaufrette/Adapter/OpenCloudSpec.php
3839
rm spec/Gaufrette/Adapter/GoogleCloudStorageSpec.php
@@ -42,7 +43,7 @@ remove-phpspec:
4243
rm spec/Gaufrette/Adapter/GridFSSpec.php
4344
rm spec/Gaufrette/Adapter/PhpseclibSftpSpec.php
4445

45-
require-all:
46+
require-all-legacy:
4647
composer require --no-update \
4748
aws/aws-sdk-php:^3.158 \
4849
rackspace/php-opencloud:^1.9.2 \
@@ -54,3 +55,7 @@ require-all:
5455
mongodb/mongodb:^1.1 \
5556
symfony/event-dispatcher:^4.4
5657

58+
59+
require-all: require-all-legacy
60+
composer require --no-update async-aws/simple-s3:^0.1.1
61+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ your issue or pull request in a timely manner, ping us:
4747

4848
| Adapter | Referent |
4949
|--------------------|-----------------------------|
50+
| AsyncAws S3 | @Nyholm |
5051
| AwsS3 | @NiR- |
5152
| AzureBlobStorage | @NiR- |
5253
| DoctrineDbal | @pedrotroller, @NicolasNSSM |

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ install:
6161
- IF %PHP%==1 echo openssl.cafile=c:\php\cacert.pem >> php.ini
6262
- cd C:\projects\gaufrette
6363
- curl -fsSL -o composer.phar https://getcomposer.org/composer.phar
64-
- php composer.phar require --no-update aws/aws-sdk-php:^3.158 rackspace/php-opencloud:^1.9.2 google/apiclient:^1.1.3 doctrine/dbal:^2.3 league/flysystem:^1.0 microsoft/azure-storage-blob:^1.0 phpseclib/phpseclib:^2.0 mongodb/mongodb:^1.1 symfony/event-dispatcher:^4.4
64+
- php composer.phar require --no-update async-aws/simple-s3:^0.1.1 aws/aws-sdk-php:^3.158 rackspace/php-opencloud:^1.9.2 google/apiclient:^1.1.3 doctrine/dbal:^2.3 league/flysystem:^1.0 microsoft/azure-storage-blob:^1.0 phpseclib/phpseclib:^2.0 mongodb/mongodb:^1.1 symfony/event-dispatcher:^4.4
6565
- php composer.phar update --prefer-dist --no-interaction --no-progress --no-suggest --ansi
6666

6767
test_script:

doc/adapters/async-aws-s3.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
currentMenu: async-aws-s3
3+
---
4+
5+
# AsyncAws S3
6+
7+
First, you will need to install the simple S3 client:
8+
```bash
9+
composer require async-aws/simple-s3
10+
```
11+
12+
In order to use this adapter you'll need an access key and a secret key.
13+
14+
## Example
15+
16+
```php
17+
<?php
18+
19+
use AsyncAws\SimpleS3\SimpleS3Client;
20+
use Gaufrette\Adapter\AsyncAwsS3 as AwsS3Adapter;
21+
use Gaufrette\Filesystem;
22+
23+
$s3client = new SimpleS3Client([
24+
'accessKeyId' => 'your_key_here',
25+
'accessKeySecret' => 'your_secret',
26+
'region' => 'eu-west-1',
27+
]);
28+
29+
$adapter = new AwsS3Adapter($s3client, 'your-bucket-name');
30+
$filesystem = new Filesystem($adapter);
31+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace spec\Gaufrette\Adapter;
4+
5+
use AsyncAws\SimpleS3\SimpleS3Client;
6+
use Gaufrette\Adapter\MimeTypeProvider;
7+
use PhpSpec\ObjectBehavior;
8+
9+
class AsyncAwsS3Spec extends ObjectBehavior
10+
{
11+
/**
12+
* @param \AsyncAws\SimpleS3\SimpleS3Client $service
13+
*/
14+
function let(SimpleS3Client $service)
15+
{
16+
$this->beConstructedWith($service, 'bucketName');
17+
}
18+
19+
function it_is_initializable()
20+
{
21+
$this->shouldHaveType('Gaufrette\Adapter\AsyncAwsS3');
22+
}
23+
24+
function it_is_adapter()
25+
{
26+
$this->shouldHaveType('Gaufrette\Adapter');
27+
}
28+
29+
function it_supports_metadata()
30+
{
31+
$this->shouldHaveType('Gaufrette\Adapter\MetadataSupporter');
32+
}
33+
34+
function it_supports_sizecalculator()
35+
{
36+
$this->shouldHaveType('Gaufrette\Adapter\SizeCalculator');
37+
}
38+
39+
function it_provides_mime_type()
40+
{
41+
$this->shouldHaveType(MimeTypeProvider::class);
42+
}
43+
}

0 commit comments

Comments
 (0)