Skip to content

moderntribe/tribe-storage-aws-s3

Repository files navigation

Tribe Storage: AWS S3 Adapter

PHPCS + Unit Tests php 7.4+

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": "[email protected]:moderntribe/tribe-storage-aws-s3.git"
      },
      {
        "type": "vcs",
        "url": "[email protected]: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

More Resources:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages