moderntribe/tribe-storage-aws-s3

本软件包最新版本(v3.0.0)没有提供许可证信息。

AWS S3 SDK v3.x 的 Tribes 存储适配器

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

This package is auto-updated.

Last update: 2024-08-30 21:04:16 UTC


README

PHPCS + Unit Tests php 7.4+

这是 WordPress 插件 Tribe Storage 的 AWS S3 适配器。本适配器旨在由 开发者 进行配置和安装。

安装 Composer v1

注意:此操作还将自动安装 Tribes 存储插件,请确保您已配置 Composer 安装器 以用于 WordPress 插件。

将以下内容添加到 composer.json 中的 repositories 对象

  "repositories": [
      {
        "type": "vcs",
        "url": "git@github.com:moderntribe/tribe-storage-aws-s3.git"
      },
      {
        "type": "vcs",
        "url": "git@github.com:moderntribe/tribe-storage.git"
      },
  ]

然后运行

composer require moderntribe/tribe-storage-aws-s3

配置

wp-config.php 中定义适配器和您的存储桶名称

define( 'TRIBE_STORAGE_ADAPTER', \Tribe\Storage\Adapters\S3_Adapter::class );
define( 'TRIBE_STORAGE_S3_BUCKET', 'mybucketname' );

wp-config.php 中定义最小 S3 选项

define( 'TRIBE_STORAGE_S3_OPTIONS', [
	'credentials' => [
		'key'    => 'YOUR-KEY',
		'secret' => 'YOUR-SECRET-KEY',
	],
	'region'      => 'us-east-1',
	'version'     => 'latest',
] );

wp-config.php 中定义 CDN 的 URL 或您的存储桶的公共 URL

// Ideally this should be a CDN URL
define( 'TRIBE_STORAGE_URL', 'https://s3-us-east-1.amazonaws.com/bucket/' . TRIBE_STORAGE_S3_BUCKET );

完整的 S3 客户端配置选项可通过 AWS 文档 获得。此外,这可以通过 tribe/storage/s3_client_options 过滤器进行配置。

自动化测试

通过 PHPUnitBrain Monkey 测试套件提供测试。

运行单元测试

$ composer install
$ ./vendor/bin/phpunit

更多资源