承接 imonroe/mimeutils 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

imonroe/mimeutils

Composer 安装命令:

composer require imonroe/mimeutils

包简介

A helper for working with MIME types, particularly for validating uploads.

README 文档

README

A helper class for working with MIME types. Should be particularly useful for validating file uploads.

Based on the MIME type list found here.

Install

Via Composer

$ composer require imonroe/mime_utils

Usage

  $allowed_mimes = new MimeUtils;
  // You can allow all the available types:
  $allowed_mimes->allow_all();
  
  // or you can allow just certain subtypes:
  $allowed_mimes->allow('image');
  $allowed_mimes->allow('video');
  
  // text types include htm, html, css
  $allowed_mimes->allow('text');
  $allowed_mimes->allow('audio');
  
  // The application types allow potentially problematic types, e.g., pdf, swf, js, class
  // enable it only if necessary.
  $allowed_mimes->allow('application');
  $allowed_mimes->allow('ms-office');
  $allowed_mimes->allow('open-office');
  $allowed_mimes->allow('wordperfect');
  $allowed_mimes->allow('iwork');
  
  // You can get the allowed extenstions as a string:
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('string');
  // or as an array: 
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('array');
  // or as JSON:
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('json');

  // You can also get the types in the same way, in the same formats:
  $mime_string = 'mimes:' . $allowed_mimes->get_types('string');
  // or 
  $mime_string = 'mimes:' . $allowed_mimes->get_types('array');
  // or 
  $mime_string = 'mimes:' . $allowed_mimes->get_types('json');

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email ian@ianmonroe.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固