gaufrette/extras

为Gaufrette提供额外功能(以fs前缀,可解析fs)

v0.1.0 2017-06-17 15:28 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:14:18 UTC


README

Build Status Quality Score Packagist Version Total Downloads Software License

提供围绕Gaufrette的额外功能,如可解析文件系统。

可解析文件系统

ResolvableFilesystem是一个装饰器,允许将对象路径解析为URL。

为了使用它,您必须传递装饰后的文件系统和解析器

$client     = // AwsS3 client instantiation
$decorated  = new Filesystem(new AwsS3($client, 'my_bucket', ['directory' => 'root/dir']));
$filesystem = new ResolvableFilesystem(
    $decorated,
    new AwsS3PresignedUrlResolver($client, 'my_bucket', 'root/dir', new \DateTime('+ 1 hour'))
);

然后您可以调用resolve($key)

$filesystem->resolve('/foo.png'); // = 'https://...

目前支持以下解析器

  • AwsS3PublicUrlResolver
  • AwsS3PresignedUrlResolver
  • StaticUrlResolver