brightnucleus/mime-types

Automatically updated MIME types database, using the Apache HTTP Server configuration.

Installs: 2 261

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:composer-plugin

v0.2.0 2017-10-02 07:00 UTC

This package is auto-updated.

Last update: 2024-10-16 05:54:40 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

This is a Composer plugin that provides an automated version of the MIME types as defined by the Apache HTTP Server.

The main advantage is that the downloaded database will be updated on each composer install and composer update.

Table Of Contents

Attribution

This package uses data from the Apache HTTP Server, licensed under the Apache License v2.0.

You can read a copy of this license at http://svn.apache.org/repos/asf/httpd/httpd/trunk/LICENSE.

Installation

The only thing you need to do to make this work is adding this package as a dependency to your project:

composer require brightnucleus/mime-types

Basic Usage

On each composer install or composer update, a check will be made to see whether there's a new version of the database available. If there is, that new version is downloaded.

Usage is pretty straight-forward. Just use one of the two provided static methods:

<?php

use BrightNucleus\MimeTypes\MimeTypes;

// Get the extensions for a given MIME type.
$extensions = MimeTypes::getExtensionsForType( 'image/jpeg' ); // Returns array( 'jpeg', 'jpg', 'jpe' ).

// Get the MIME types for a given extension.
$mimeTypes = MimeTypes::getTypesForExtension( 'jpg' ); // Returns array( 'image/jpeg' ).

Contributing

All feedback / bug reports / pull requests are welcome.

License

This code is released under the MIT license.

For the full copyright and license information, please view the LICENSE file distributed with this source code.