2017 © Pedro Peláez
 

library mime

The Hoa\Mime library.

image

hoa/mime

The Hoa\Mime library.

  • Tuesday, March 6, 2018
  • by Hoa
  • Repository
  • 12 Watchers
  • 85 Stars
  • 68,874 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 13 Forks
  • 1 Open issues
  • 16 Versions
  • 14 % Grown

The README.md

Hoa , (*1)


Build status Code coverage Packagist License , (*2)

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds. , (*3)

Hoa\Mime

Help on IRC Help on Gitter Documentation Board, (*4)

This library allows to manipulate a MIME types database and get some related informations about streams., (*5)

Learn more., (*6)

Installation

With Composer, to include this library into your dependencies, you need to require hoa/mime:, (*7)

$ composer require hoa/mime '~3.0'

For more installation procedures, please read the Source page., (*8)

Testing

Before running the test suites, the development dependencies must be installed:, (*9)

$ composer install

Then, to run all the test suites:, (*10)

$ vendor/bin/hoa test:run

For more information, please read the contributor guide., (*11)

Quick usage

As a quick overview, we will see how to get general and stream-related informations., (*12)

General informations

All we need is static methods Hoa\Mime\Mime::getExtensionsFromMime to get extensions from a type and Hoa\Mime\Mime::getMimeFromExtension to get type from an extension:, (*13)

print_r(Hoa\Mime\Mime::getExtensionsFromMime('text/html'));

/**
 * Will output:
 *     Array
 *     (
 *         [0] => html
 *         [1] => htm
 *     )
 */

var_dump(Hoa\Mime\Mime::getMimeFromExtension('webm'));

/**
 * Will output:
 *     string(10) "video/webm"
 */

By default, Hoa\Mime\Mime uses the hoa://Library/Mime/Mime.types file as database. We can change this behavior by calling the Hoa\Mime\Mime::compute before any computations:, (*14)

Hoa\Mime\Mime::compute('/etc/mime.types');

Stream-related informations

By instanciating the Hoa\Mime\Mime class with a stream, we are able to get some informations about the stream, such as its extension, others extensions, type, etc. Thus:, (*15)

$type = new Hoa\Mime\Mime(new Hoa\File\Read('index.html'));

var_dump(
    $type->getExtension(),
    $type->getOtherExtensions(),
    $type->getMime(),
    $type->isExperimental()
);

/**
 * Will output:
 *     string(4) "html"
 *     array(1) {
 *       [0]=>
 *       string(3) "htm"
 *     }
 *     string(9) "text/html"
 *     bool(false)
 */

Documentation

The hack book of Hoa\Mime contains detailed information about how to use this library and how it works., (*16)

To generate the documentation locally, execute the following commands:, (*17)

$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open

More documentation can be found on the project's website: hoa-project.net., (*18)

Getting help

There are mainly two ways to get help:, (*19)

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know., (*20)

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details., (*21)

The following projects are using this library:, (*22)

  • E-Conf, E-Conf is a Conference Management System,
  • sabre/katana, A contact, calendar, task list and file server.

The Versions

06/03 2018

dev-master

9999999-dev https://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

10/01 2017
14/01 2016
14/01 2016
11/01 2016
29/10 2015

2.15.10.29

2.15.10.29 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

28/07 2015

2.15.07.28

2.15.07.28 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

29/05 2015

2.15.05.29

2.15.05.29 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

24/02 2015

2.15.02.24

2.15.02.24 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

09/12 2014

2.14.12.10

2.14.12.10 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

25/11 2014

2.14.11.26

2.14.11.26 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

26/09 2014

2.14.11.09

2.14.11.09 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

23/09 2014

2.14.09.23

2.14.09.23 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

22/09 2014

2.14.09.22

2.14.09.22 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

mime library type

17/09 2014

2.14.09.17

2.14.09.17 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

mime library type

16/09 2014

1.14.09.16

1.14.09.16 http://hoa-project.net/

The Hoa\Mime library.

  Sources   Download

BSD-3-Clause

The Requires

 

mime library type