2017 © Pedro Peláez
 

library mimeutils

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

image

imonroe/mimeutils

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

  • Sunday, April 22, 2018
  • by imonroe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 144 % Grown

The README.md

mime_utils

A helper class for working with MIME types. Should be particularly useful for validating file uploads., (*1)

Based on the MIME type list found here., (*2)

Install

Via Composer, (*3)

``` bash $ composer require imonroe/mime_utils, (*4)


## Usage ``` php $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., (*5)

Testing

bash $ composer test, (*6)

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*7)

Security

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

Credits

License

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

The Versions

22/04 2018

dev-master

9999999-dev https://github.com/imonroe/mimeutils

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

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes imonroe mimeutils

22/04 2018

0.1.0

0.1.0.0 https://github.com/imonroe/mimeutils

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

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes imonroe mimeutils