From d4777c9c20bf90a5662ab68af5915e60366e3c2e Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Sun, 25 Aug 2024 13:06:25 -0400 Subject: [PATCH] updates and docs --- docs/components/filesystem/adapters.md | 16 ++++++++++ docs/components/filesystem/index.md | 31 +++++++++++++++++++ .../Loader/SonsOfPHPFilesystemLoader.php | 3 ++ .../Resolver/SonsOfPHPFilesystemResolver.php | 3 ++ 4 files changed, 53 insertions(+) diff --git a/docs/components/filesystem/adapters.md b/docs/components/filesystem/adapters.md index be48d226..78c50d93 100644 --- a/docs/components/filesystem/adapters.md +++ b/docs/components/filesystem/adapters.md @@ -100,3 +100,19 @@ use SonsOfPHP\Component\Filesystem\Adapter\NativeAdapter; $adapter = new WormAdapter(new NativeAdater('/tmp')); ``` + +## Additional Adapters + +### AWS S3 + +```shell +composer require sonsofphp/filesystem-aws +``` + +```php +copy('source.txt', 'destination.txt'); $filesystem->move('source.txt', 'destination.txt'); ``` +## Support for LiipImagineBundle + +```shell +composer require sonsofphp/filesystem-liip-imagine +``` + +```yaml +# config/services.yaml +services: + SonsOfPHP\Contract\Filesystem\Adapter\AdapterInterface: + class: SonsOfPHP\Component\Filesystem\Adapter\NativeAdapter + arguments: ['%kernel.project_dir%/var/data/%kernel.id%'] + SonsOfPHP\Contract\Filesystem\FilesystemInterface: + class: SonsOfPHP\Component\Filesystem\Filesystem + arguments: ['@SonsOfPHP\Contract\Filesystem\Adapter\AdapterInterface'] + imagine.cache.resolver.sonsofphp: + class: SonsOfPHP\Bridge\LiipImagine\Filesystem\Imagine\Cache\Resolver\SonsOfPHPFilesystemResolver + arguments: + - '@SonsOfPHP\Contract\Filesystem\FilesystemInterface' + - 'https://images.example.com' + tags: + - { name: "liip_imagine.cache.resolver", resolver: sonsofphp } +``` + +```yaml +# config/packages/liip_imagine.yaml +liip_imagine: + data_loader: SonsOfPHP\Bridge\LiipImagine\Filesystem\Binary\Loader\SonsOfPHPFilesystemLoader + cache: sonsofphp +``` + ## Need Help? Check out [Sons of PHP's Organization Discussions][discussions]. diff --git a/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Binary/Loader/SonsOfPHPFilesystemLoader.php b/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Binary/Loader/SonsOfPHPFilesystemLoader.php index 26450263..e30dfc7f 100644 --- a/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Binary/Loader/SonsOfPHPFilesystemLoader.php +++ b/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Binary/Loader/SonsOfPHPFilesystemLoader.php @@ -11,6 +11,9 @@ use SonsOfPHP\Contract\Filesystem\FilesystemInterface; use Symfony\Component\Mime\MimeTypesInterface; +/** + * @author Joshua Estes + */ class SonsOfPHPFilesystemLoader implements LoaderInterface { public function __construct( diff --git a/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Imagine/Cache/Resolver/SonsOfPHPFilesystemResolver.php b/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Imagine/Cache/Resolver/SonsOfPHPFilesystemResolver.php index e687cfa1..263c2ad5 100644 --- a/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Imagine/Cache/Resolver/SonsOfPHPFilesystemResolver.php +++ b/src/SonsOfPHP/Bridge/LiipImagine/Filesystem/Imagine/Cache/Resolver/SonsOfPHPFilesystemResolver.php @@ -9,6 +9,9 @@ use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; use SonsOfPHP\Contract\Filesystem\FilesystemInterface; +/** + * @author Joshua Estes + */ class SonsOfPHPFilesystemResolver implements ResolverInterface { public function __construct(