moderntribe / tribe-storage-aws-s3
Tribe Storage Adapter for AWS S3 SDK v3.x
Requires
- php: >=7.4
- league/flysystem-aws-s3-v3: ^1.0
- moderntribe/tribe-storage: ^3.0
- php-di/php-di: ^6.0
Requires (Dev)
- brain/monkey: 2.*
- moderntribe/coding-standards: ^2.0
- php-mock/php-mock-mockery: ^1.3
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-10-30 21:16:41 UTC
README
The AWS S3 adapter for the Tribe Storage WordPress plugin. This adapter is meant to be configured and installed by developers.
Installation Composer v1
Note: This also automatically installs the Tribe Storage plugin, ensure you have configured Composer Installers for WordPress plugins.
Add the following to the composer.json repositories
object:
"repositories": [ { "type": "vcs", "url": "git@github.com:moderntribe/tribe-storage-aws-s3.git" }, { "type": "vcs", "url": "git@github.com:moderntribe/tribe-storage.git" }, ]
Then run:
composer require moderntribe/tribe-storage-aws-s3
Configuration
Define the adapter, and your bucket name in wp-config.php
:
define( 'TRIBE_STORAGE_ADAPTER', \Tribe\Storage\Adapters\S3_Adapter::class ); define( 'TRIBE_STORAGE_S3_BUCKET', 'mybucketname' );
Define the minimum S3 options in wp-config.php
:
define( 'TRIBE_STORAGE_S3_OPTIONS', [ 'credentials' => [ 'key' => 'YOUR-KEY', 'secret' => 'YOUR-SECRET-KEY', ], 'region' => 'us-east-1', 'version' => 'latest', ] );
Define the URL of the CDN or the public URL for your bucket in wp-config.php
:
// Ideally this should be a CDN URL define( 'TRIBE_STORAGE_URL', 'https://s3-us-east-1.amazonaws.com/bucket/' . TRIBE_STORAGE_S3_BUCKET );
Full S3 client configuration options are available via
AWS documentation.
Additionally, this can be configured with the tribe/storage/s3_client_options
filter.
Automated Testing
Testing provided via PHPUnit and the Brain Monkey testing suite.
Run Unit Tests
$ composer install $ ./vendor/bin/phpunit