2017 © Pedro Peláez
 

library mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

image

skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  • Monday, September 26, 2016
  • by skyzyx
  • Repository
  • 2 Watchers
  • 11 Stars
  • 35,348 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 5 Versions
  • 8 % Grown

The README.md

Mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project., (*1)

How to use

Step 1

Download the latest copy of the Apache mime-types file into the same directory as the generate script., (*2)

cd mimetypes &&
wget --no-check-certificate https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x/docs/conf/mime.types

Step 1.5 (optional)

Update the provided customize.json document with any additional mimetypes to define, or any that you would like to override., (*3)

Step 2

Run the generate script., (*4)

./generate

In the end, a mimetypes.json document will be generated. This JSON document can be easily parsed into a map/dictionary/associative array by pretty much every programming language with little effort., (*5)

It also generates a backing PHP class if you want to use the data in PHP-land., (*6)

Installation

Install source from GitHub

To install the source code:, (*7)

git clone git://github.com/skyzyx/mimetypes.git

And use it in your scripts:, (*8)

$mimetypes = json_decode('/path/to/mimetypes/mimetypes.json', true);
$type = $mimetypes['html'];
#=> text/html

// ...or...

use Skyzyx\Components\Mimetypes\Mimetypes;
$type = Mimetypes::getInstance()->fromExtension('html');
#=> text/html

Install with Composer

If you're using Composer to manage dependencies, you can add the mimetypes with it., (*9)

{
    "require": {
        "skyzyx/mimetypes": ">=1.0"
    }
}

See Also...

For a similar-yet-different approach (including reverse-lookups from mimetypes => extensions), check out dflydev-apache-mime-types., (*10)

Copyright (c) 2010-2013 Ryan Parman. Licensed for use under the terms of the MIT license. See the list of contributors for more author information., (*11)

The Versions

26/09 2016

dev-master

9999999-dev http://github.com/skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

mime dictionary map mimetype

31/03 2013

1.1.1

1.1.1.0 http://github.com/skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

mime dictionary map mimetype

06/12 2012

1.1

1.1.0.0 http://github.com/skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

mime dictionary map mimetype

06/12 2012

1.0.1

1.0.1.0 http://github.com/skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

The Development Requires

mime dictionary map mimetype

06/02 2012

1.0

1.0.0.0 http://github.com/skyzyx/mimetypes

Creates a JSON document containing a thorough list of file extensions => mime types as provided by the Apache httpd project.

  Sources   Download

MIT

The Requires

  • php >=5.2

 

mime dictionary map mimetype