blackcube / fileprovider
File provider with prefix routing and image processing
1.0.0
2026-03-21 17:47 UTC
Requires
- php: ^8.0
- blackcube/injector: ^1.0
- league/flysystem: ^3.32
- yiisoft/aliases: ^3.1
Requires (Dev)
- codeception/codeception: ^5.3
- codeception/module-asserts: ^3.3
- codeception/module-filesystem: ^3.0
- codeception/module-phpbrowser: ^4.0
- codeception/module-rest: ^3.4
- intervention/image: ^3.11
- league/flysystem-aws-s3-v3: ^3.32
- league/flysystem-ftp: ^3.31
- league/flysystem-sftp-v3: ^3.31
- nyholm/psr7: ^1.8
- nyholm/psr7-server: ^1.1
- phpcompatibility/php-compatibility: ^9.3
- vlucas/phpdotenv: ^5.6
- yiisoft/data-response: ^2.2
- yiisoft/di: ^1.4
- yiisoft/http: ^1.3
- yiisoft/test-support: ^3.2
Suggests
- 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
This package is auto-updated.
Last update: 2026-03-21 17:48:24 UTC
README
Multi-filesystem file provider with prefix routing, image processing, cached file helpers, and Resumable.js upload.
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 # Functional tests (starts HTTP server) make test-functional # All tests make test
Documentation
- Overview & prerequisites
- Installation (standalone)
- Installation (Yii)
- API — FileProvider
- API — CacheFile
- API — Resumable
License
BSD-3-Clause. See LICENSE.md.
Author
Philippe Gaultier philippe@blackcube.io