moderntribe/tribe-storage-aws-s3

There is no license information available for the latest version (v3.0.0) of this package.

Tribe Storage Adapter for AWS S3 SDK v3.x

v3.0.0 2024-03-01 19:51 UTC

This package is auto-updated.

Last update: 2024-03-30 20:05:12 UTC


README

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": "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

More Resources: