Download the PHP package adrienrn/php-mimetyper without Composer

On this page you can find all versions of the php package adrienrn/php-mimetyper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-mimetyper

php-mimetyper

PHP mime type and extension mapping library: built with jshttp/mime-db, compatible with Symfony and Laravel.

The most complete and up-to-date mime type mapping for PHP!

The goal is to provide a complete and up-to-date mime types mapping for PHP and build a comprehensive and simple interface for PHP. This package is heavily inspired from dflydev work and extends it.

Mime types mapping, the right way.

This library uses jshttp/mime-db as its default mapping which aggregates data from multiple sources and creates a single db.json making it the most complete two ways mapping, from mime to extension and extension to mime types too.

Custom mime types and custom repositories

Some custom types (aliases really) are maintained locally too, in the same JSON format as jshttp/mime-db.

The reason to maintain aliases locally helps with overall compatibility between mime type guessing methods. Tools detecting mime types don't always return standard mime type or the standard mime type does not exist. All of those custom mime types might be added to jshttp/mime-db custom types in the end.

Example: Debian will detect a PHP file as text/x-php while browsers will send application/x-httpd-php. It goes the same with files such as Javascript (application/javascript vs text/javascript) or Microsoft Office / Libre Office files.

Don't hesitate to make a pull request to discuss this.

Mime types for Symfony and Laravel

This library is compatible with your Symfony or Laravel app to enjoy the completeness of the mapping.

Use the ExtraMimeTypeExtensionGuesser as a bridge class between Symfony ExtensionGuesser and this package RepositoryInterface.

This example uses the ExtendedRepository (mime-db and local custom mime types), you can use the default MimeDbRepository, implement your own or use a CompositeRepository to aggregate multiple repostories.

Safe detection of mime type in PHP

Before mapping type to extension or extension to type, you need to be able to properly detect the mime type of a file.

For security reasons, do not trust browsers, eg $_FILES['your_file']['type'], when it comes to detect the mime type of a file.

To safely detect the mime type of a file, . Symfony is giving a great example with their MimeTypeGuesser implementation of:

It all ends up inspecting the file using finfo and relies on magic db files. PHP will use its own magic db or your system magic db depending on your environement.

Other PHP libraries for mime types


All versions of php-mimetyper with dependencies

PHP Build Version
Package Version
Requires dflydev/apache-mime-types Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package adrienrn/php-mimetyper contains the following files

Loading the files please wait ....