blackcube / fileprovider
File provider with prefix routing and image processing
1.0.0
2026-10-25 09:28 UTC
Requires
- php: ^8.2
- ext-fileinfo: *
- blackcube/injector: ^1.0
- league/flysystem: ^3.36
- psr/log: ^3.0
- yiisoft/aliases: ^3.1
Requires (Dev)
- codeception/codeception: ^5.3
- codeception/module-asserts: ^3.3
- intervention/image: ^3.11 || ^4.3
- league/flysystem-aws-s3-v3: ^3.35
- league/flysystem-ftp: ^3.36
- league/flysystem-sftp-v3: ^3.36
- phpcompatibility/php-compatibility: ^9.3
- vlucas/phpdotenv: ^5.7
- yiisoft/di: ^1.4
- yiisoft/test-support: ^3.2
Suggests
- blackcube/resumable: Resumable.js upload actions (chunks, preview, delete) on the temporary store
- intervention/image: Required for image processors (resize, watermark, etc.)
- league/flysystem-aws-s3-v3: Required for S3/MinIO storage
- league/flysystem-ftp: Required for FTP storage
- league/flysystem-sftp-v3: Required for SFTP storage
Provides
None
Conflicts
- intervention/image: <3.11 || >=5.0
Replaces
None
This package is auto-updated.
Last update: 2026-10-25 09:30:13 UTC
README
Multi-filesystem file provider with prefix routing, image processing and cached file helpers.
You write @blfs/image.jpg, FileProvider routes to S3. You chain ->cover(300, 200)->read(), it processes on the fly. You never touch Flysystem directly.
Quickstart
composer require blackcube/fileprovider
use Blackcube\FileProvider\FileProvider; use Blackcube\FileProvider\Flysystem\FlysystemLocal; use Yiisoft\Aliases\Aliases; $provider = new FileProvider(new Aliases()); $provider->addFilesystem('@bltmp', new FlysystemLocal('/tmp/uploads')); $provider->addFilesystem('@blfs', new FlysystemLocal('/var/www/storage')); // Write, move, read $provider->write('@bltmp/upload.jpg', $content); $provider->move('@bltmp/upload.jpg', '@blfs/images/photo.jpg'); $content = $provider->read('@blfs/images/photo.jpg'); // Image processing (requires intervention/image) $thumbnail = $provider->cover(200, 200)->read('@blfs/images/photo.jpg');
Tests
# Unit tests (Provider, Integration, Local suites) make test-unit # All tests make test
Documentation
- Overview & prerequisites
- Installation (standalone)
- Installation (Yii)
- API — FileProvider
- API — CacheFile
License
BSD-3-Clause. See LICENSE.md.
Author
Philippe Gaultier philippe@blackcube.io