tinram/file-identifier 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tinram/file-identifier

Composer 安装命令:

composer require tinram/file-identifier

包简介

A simple library to identify files through MIME types and file signatures.

README 文档

README

Identify a file through MIME type and file signature detection.

Purpose

Detect a file's type through MIME type information and file signature (header) bytes.

(File extensions are ignored.)

Uses

*nix systems have the file command, which is a powerful file identifier, and callable from PHP's shell functions.

Nevertheless, this command is not always available.

The main uses of File Identifier are:

  • For *nix servers where PHP shell functions are disabled in php.ini ( disable_functions= )
  • PHP running on Windows, where no file command natively exists
  • When older versions of file (e.g. v. 5.09) are installed on the *nix server, and which do not recognise some files such as .gpg
  • Where custom, old, or rare file types cannot be identified by the file command.

Example Usage

    require('FileIdentifier.php');
    require('FileSignatures.php');

    use Tinram\FileIdentifier\FileIdentifier;

    $f = new FileIdentifier('mira.png');
    $r = $f->getResult();
    echo $r['mimeinfo'] . PHP_EOL . $r['fileinfo'];

File Signatures

The file signature data (FileSignatures.php) contain a limited range of common file type signatures in hexadecimal bytes.

This data array can be easily extended with additional and custom file signatures.

License

File Identifier is released under the GPL v.3.

统计信息

  • 总下载量: 296
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-01-17