2017 © Pedro Peláez
 

library mimetypes

PHP MIME Types Guesser and extension mapping.

image

narrowspark/mimetypes

PHP MIME Types Guesser and extension mapping.

  • Wednesday, July 18, 2018
  • by dani33
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,690 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 11 Versions
  • 77 % Grown

The README.md

MIME Types

PHP MIME Types Guesser and extension mapper.

, (*1)

built with [jshttp/mime-db][1]., (*2)

Mime types mapping, the right way.

This library uses [jshttp/mime-db][1] as its default mapping which aggregates data from multiple sources and creates a single db.json making it the most complete mapping. - IANA - Apache - Nginx, (*3)

Installation

composer require narrowspark/mimetypes

Use

This mime type guesser has support for all OS supported guesser., (*4)

<?php
    use Narrowspark\MimeType\MimeType;

    // You can register custom guessers by calling the register() method
    MimeType::register('CustomGuesser');

    return MimeType::guess('image.gif'); // returns image/gif

You looking for the full mime type array? Just use:, (*5)

<?php
    use Narrowspark\MimeType\MimeTypesList;

    return MimeTypesList::MIMES; // returns array

If you like to use the build in php mime type guesser, just use:, (*6)

<?php
    use Narrowspark\MimeType\MimeTypeFileInfoGuesser;
    use Narrowspark\MimeType\MimeTypeFileBinaryGuesser;
    use Narrowspark\MimeType\MimeTypeExtensionGuesser;
    use Narrowspark\MimeType\MimeTypeFileExtensionGuesser;


    // Inspecting the file using finfo and relies on magic db files.
    return MimeTypeFileInfoGuesser::guess('image.gif'); // returns image/gif
    // Inspecting the file using file -b --mime
    return MimeTypeFileBinaryGuesser::guess('image.gif'); // returns image/gif
    // Inspecting the extension using mime type list
    return MimeTypeExtensionGuesser::guess('gif'); // returns image/gif
    // Inspecting the file using mime type list
    return MimeTypeFileExtensionGuesser::guess('image.gif'); // returns image/gif

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild., (*7)

Note: Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms., (*8)

License

The Narrowspark mimetypes is open-sourced software licensed under the MIT license, (*9)

The Versions

18/07 2018

dev-master

9999999-dev

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetype mimetypes narrowspark guesser

18/07 2018

v1.0.2

1.0.2.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetype mimetypes narrowspark guesser

04/06 2018

v1.0.1

1.0.1.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetype mimetypes narrowspark guesser

21/05 2018

v1.0.0

1.0.0.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetype mimetypes narrowspark guesser

21/05 2018

v1.x-dev

1.9999999.9999999.9999999-dev

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetype mimetypes narrowspark guesser

30/04 2018

v0.1.5

0.1.5.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark

21/02 2018

v0.1.4

0.1.4.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark

12/02 2018

v0.1.3

0.1.3.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark

27/10 2017

v0.1.2

0.1.2.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark

09/09 2017

v0.1.1

0.1.1.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark

08/09 2017

v0.1.0

0.1.0.0

PHP MIME Types Guesser and extension mapping.

  Sources   Download

MIT

The Requires

 

The Development Requires

mimetypes narrowspark