alex-kalanis/kw_mime
Composer 安装命令:
composer require alex-kalanis/kw_mime
包简介
Determine file mime type in KWCMS
关键字:
README 文档
README
Simple library to access mime type of sent file. Just makes nice facade to mime libraries.
PHP Installation
composer.phar require alex-kalanis/kw_mime
(Refer to Composer Documentation if you are not familiar with composer)
PHP Usage
1.) Use your autoloader (if not already done via Composer autoloader)
2.) Connect the "\kalanis\kw_mime\MimeType" into your app. Extends it for setting your case.
3.) Just call setting and render
// Somewhere in DI return function ($params): \kalanis\kw_mime\Interfaces\IMime { return (new \kalanis\kw_mime\Check\Factory())->getLibrary($params); }
// In code class MimeExample { public function __construct( // ... protected readonly \kalanis\kw_mime\Interfaces\IMime $mime, // ... ) { } public function which(string $file): string { $path = (new \kalanis\kw_paths\ArrayPath())->setString($file); return $this->mime->getMime($path->getArray()); } }
Caveats
If not specified by time of construction it uses external libraries in extension ext-fileinfo. Be aware of that.
统计信息
- 总下载量: 542
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-03-06