makinacorpus/files
Composer 安装命令:
composer require makinacorpus/files
包简介
File manager with path abstraction and file registry, storage solution.
README 文档
README
This bundle provides various helpers for managing files in Symfony:
-
Provides a
FileManagerobject which provides primitives for managing files identified with custom logical schemes (such aspublic://image/foo.png) transparently handling physical real paths. -
Provides a PHP StreamWrapper implementation for transparent usage of the custom URI schemes.
-
File index storage interface with advanced features.
-
SQL index implementation with transaction support without destructive rollbacks operations and delayed real file deletion operation.
Setup
Installation
First start with:
composer require makinacorpus/files
Then register the bundle to Symfony in config/bundles.php:
<?php return [ /// ... Your other bundles... MakinaCorpus\Files\Bridge\Symfony\FilesBundle::class => ['all' => true], ];
Then proceed with configuration.
Basic configuration
Everything should be auto-configured if you follow the rest of this section.
Custom schemes configuration
Each custom scheme is tied to a custom folder, allowing you to store protocol relative URI in your database instead of absolute path, making the application portable and migrable easily.
Per default, the bundle offers three schemes:
private://for files that should not be accessible via the HTTPd which will default to%kernel.project_dir/var/private/%,public://for files that will be freely visible via the HTTPd, which will default to%kernel.project_dir/public/files/,temporary://for temporary files, which will default to PHP configured temporary folder,upload://for chunked file upload, which defaults totemporary://filechunk/webroot://for files that are in the public directory, will default to%kernel.project_dir/public,
Only the temporary one cannot be configured, all others can be set via
the following .env file variables:
FILE_PRIVATE_DIR="%kernel.project_dir%/var/private"
FILE_PUBLIC_DIR="%kernel.project_dir%/public/files"
FILE_UPLOAD_DIR="%kernel.project_dir%/var/tmp/upload"
FILE_WEBROOT_DIR="%kernel.project_dir%/public"
Usage
File manager API
Documentation will come soon.
File storage API
Documentation will come soon.
Notes about migration from makinacorpus/filechunk-bundle
-
Environment variables remain the same.
-
MakinaCorpus\FilechunkBundle\FileManagerbecomesMakinaCorpus\Files\FileManager, a class alias will be registered to allow a smooth migration. -
You MUST upgrade
makinacorpus/filechunk-bundleto version>= 3if you want to keep the chunked file upload widget in order to avoid conflicts.
Credits
This code includes sligthly modified code from Drupal 8.x https://www.drupal.org
project, located in the ./StreamWrapper directory, all credits to their
original authors.
All remaining code is an original creation of Makina Corpus https://www.makina-corpus.com
makinacorpus/files 适用场景与选型建议
makinacorpus/files 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 makinacorpus/files 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 makinacorpus/files 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2022-09-21